x-twitter-scraper 0.15.0 → 0.17.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 (238) hide show
  1. package/CHANGELOG.md +63 -5
  2. package/README.md +1 -0
  3. package/client.d.mts +12 -4
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -4
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/internal/detect-platform.d.mts +3 -1
  10. package/internal/detect-platform.d.mts.map +1 -1
  11. package/internal/detect-platform.d.ts +3 -1
  12. package/internal/detect-platform.d.ts.map +1 -1
  13. package/internal/detect-platform.js +1 -1
  14. package/internal/detect-platform.js.map +1 -1
  15. package/internal/detect-platform.mjs +1 -1
  16. package/internal/detect-platform.mjs.map +1 -1
  17. package/internal/uploads.js +1 -1
  18. package/internal/uploads.js.map +1 -1
  19. package/internal/uploads.mjs +1 -1
  20. package/internal/uploads.mjs.map +1 -1
  21. package/package.json +2 -2
  22. package/resources/account.d.mts +5 -0
  23. package/resources/account.d.mts.map +1 -1
  24. package/resources/account.d.ts +5 -0
  25. package/resources/account.d.ts.map +1 -1
  26. package/resources/compose.d.mts +1 -1
  27. package/resources/compose.d.mts.map +1 -1
  28. package/resources/compose.d.ts +1 -1
  29. package/resources/compose.d.ts.map +1 -1
  30. package/resources/drafts.d.mts +13 -3
  31. package/resources/drafts.d.mts.map +1 -1
  32. package/resources/drafts.d.ts +13 -3
  33. package/resources/drafts.d.ts.map +1 -1
  34. package/resources/drafts.js +1 -1
  35. package/resources/drafts.mjs +1 -1
  36. package/resources/events.d.mts +100 -29
  37. package/resources/events.d.mts.map +1 -1
  38. package/resources/events.d.ts +100 -29
  39. package/resources/events.d.ts.map +1 -1
  40. package/resources/events.js.map +1 -1
  41. package/resources/events.mjs.map +1 -1
  42. package/resources/index.d.mts +2 -2
  43. package/resources/index.d.mts.map +1 -1
  44. package/resources/index.d.ts +2 -2
  45. package/resources/index.d.ts.map +1 -1
  46. package/resources/index.js.map +1 -1
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/monitors/index.d.mts +2 -1
  49. package/resources/monitors/index.d.mts.map +1 -1
  50. package/resources/monitors/index.d.ts +2 -1
  51. package/resources/monitors/index.d.ts.map +1 -1
  52. package/resources/monitors/index.js +3 -1
  53. package/resources/monitors/index.js.map +1 -1
  54. package/resources/monitors/index.mjs +1 -0
  55. package/resources/monitors/index.mjs.map +1 -1
  56. package/resources/monitors/keywords.d.mts +15 -65
  57. package/resources/monitors/keywords.d.mts.map +1 -1
  58. package/resources/monitors/keywords.d.ts +15 -65
  59. package/resources/monitors/keywords.d.ts.map +1 -1
  60. package/resources/monitors/monitors.d.mts +12 -5
  61. package/resources/monitors/monitors.d.mts.map +1 -1
  62. package/resources/monitors/monitors.d.ts +12 -5
  63. package/resources/monitors/monitors.d.ts.map +1 -1
  64. package/resources/monitors/monitors.js +4 -0
  65. package/resources/monitors/monitors.js.map +1 -1
  66. package/resources/monitors/monitors.mjs +4 -0
  67. package/resources/monitors/monitors.mjs.map +1 -1
  68. package/resources/monitors/posts.d.mts +344 -0
  69. package/resources/monitors/posts.d.mts.map +1 -0
  70. package/resources/monitors/posts.d.ts +344 -0
  71. package/resources/monitors/posts.d.ts.map +1 -0
  72. package/resources/monitors/posts.js +94 -0
  73. package/resources/monitors/posts.js.map +1 -0
  74. package/resources/monitors/posts.mjs +90 -0
  75. package/resources/monitors/posts.mjs.map +1 -0
  76. package/resources/shared.d.mts +671 -7
  77. package/resources/shared.d.mts.map +1 -1
  78. package/resources/shared.d.ts +671 -7
  79. package/resources/shared.d.ts.map +1 -1
  80. package/resources/support/index.d.mts +1 -1
  81. package/resources/support/index.d.mts.map +1 -1
  82. package/resources/support/index.d.ts +1 -1
  83. package/resources/support/index.d.ts.map +1 -1
  84. package/resources/support/index.js.map +1 -1
  85. package/resources/support/index.mjs.map +1 -1
  86. package/resources/support/support.d.mts +2 -2
  87. package/resources/support/support.d.mts.map +1 -1
  88. package/resources/support/support.d.ts +2 -2
  89. package/resources/support/support.d.ts.map +1 -1
  90. package/resources/support/support.js.map +1 -1
  91. package/resources/support/support.mjs.map +1 -1
  92. package/resources/support/tickets.d.mts +26 -25
  93. package/resources/support/tickets.d.mts.map +1 -1
  94. package/resources/support/tickets.d.ts +26 -25
  95. package/resources/support/tickets.d.ts.map +1 -1
  96. package/resources/support/tickets.js.map +1 -1
  97. package/resources/support/tickets.mjs.map +1 -1
  98. package/resources/webhooks.d.mts +10 -4
  99. package/resources/webhooks.d.mts.map +1 -1
  100. package/resources/webhooks.d.ts +10 -4
  101. package/resources/webhooks.d.ts.map +1 -1
  102. package/resources/webhooks.js.map +1 -1
  103. package/resources/webhooks.mjs.map +1 -1
  104. package/resources/x/accounts.d.mts +14 -4
  105. package/resources/x/accounts.d.mts.map +1 -1
  106. package/resources/x/accounts.d.ts +14 -4
  107. package/resources/x/accounts.d.ts.map +1 -1
  108. package/resources/x/accounts.js +6 -4
  109. package/resources/x/accounts.js.map +1 -1
  110. package/resources/x/accounts.mjs +6 -4
  111. package/resources/x/accounts.mjs.map +1 -1
  112. package/resources/x/broadcasts.d.mts +3 -127
  113. package/resources/x/broadcasts.d.mts.map +1 -1
  114. package/resources/x/broadcasts.d.ts +3 -127
  115. package/resources/x/broadcasts.d.ts.map +1 -1
  116. package/resources/x/communities/communities.d.mts +92 -1
  117. package/resources/x/communities/communities.d.mts.map +1 -1
  118. package/resources/x/communities/communities.d.ts +92 -1
  119. package/resources/x/communities/communities.d.ts.map +1 -1
  120. package/resources/x/communities/communities.js +14 -0
  121. package/resources/x/communities/communities.js.map +1 -1
  122. package/resources/x/communities/communities.mjs +14 -0
  123. package/resources/x/communities/communities.mjs.map +1 -1
  124. package/resources/x/communities/index.d.mts +1 -1
  125. package/resources/x/communities/index.d.mts.map +1 -1
  126. package/resources/x/communities/index.d.ts +1 -1
  127. package/resources/x/communities/index.d.ts.map +1 -1
  128. package/resources/x/communities/index.js.map +1 -1
  129. package/resources/x/communities/index.mjs.map +1 -1
  130. package/resources/x/community-notes.d.mts +122 -510
  131. package/resources/x/community-notes.d.mts.map +1 -1
  132. package/resources/x/community-notes.d.ts +122 -510
  133. package/resources/x/community-notes.d.ts.map +1 -1
  134. package/resources/x/community-notes.js.map +1 -1
  135. package/resources/x/community-notes.mjs.map +1 -1
  136. package/resources/x/index.d.mts +7 -6
  137. package/resources/x/index.d.mts.map +1 -1
  138. package/resources/x/index.d.ts +7 -6
  139. package/resources/x/index.d.ts.map +1 -1
  140. package/resources/x/index.js +3 -1
  141. package/resources/x/index.js.map +1 -1
  142. package/resources/x/index.mjs +1 -0
  143. package/resources/x/index.mjs.map +1 -1
  144. package/resources/x/jobs.d.mts +144 -283
  145. package/resources/x/jobs.d.mts.map +1 -1
  146. package/resources/x/jobs.d.ts +144 -283
  147. package/resources/x/jobs.d.ts.map +1 -1
  148. package/resources/x/jobs.js.map +1 -1
  149. package/resources/x/jobs.mjs.map +1 -1
  150. package/resources/x/lists.d.mts +27 -425
  151. package/resources/x/lists.d.mts.map +1 -1
  152. package/resources/x/lists.d.ts +27 -425
  153. package/resources/x/lists.d.ts.map +1 -1
  154. package/resources/x/media.d.mts +13 -2
  155. package/resources/x/media.d.mts.map +1 -1
  156. package/resources/x/media.d.ts +13 -2
  157. package/resources/x/media.d.ts.map +1 -1
  158. package/resources/x/media.js.map +1 -1
  159. package/resources/x/media.mjs.map +1 -1
  160. package/resources/x/profile.d.mts +13 -4
  161. package/resources/x/profile.d.mts.map +1 -1
  162. package/resources/x/profile.d.ts +13 -4
  163. package/resources/x/profile.d.ts.map +1 -1
  164. package/resources/x/profile.js.map +1 -1
  165. package/resources/x/profile.mjs.map +1 -1
  166. package/resources/x/spaces.d.mts +213 -669
  167. package/resources/x/spaces.d.mts.map +1 -1
  168. package/resources/x/spaces.d.ts +213 -669
  169. package/resources/x/spaces.d.ts.map +1 -1
  170. package/resources/x/spaces.js.map +1 -1
  171. package/resources/x/spaces.mjs.map +1 -1
  172. package/resources/x/sports.d.mts +1349 -0
  173. package/resources/x/sports.d.mts.map +1 -0
  174. package/resources/x/sports.d.ts +1349 -0
  175. package/resources/x/sports.d.ts.map +1 -0
  176. package/resources/x/sports.js +76 -0
  177. package/resources/x/sports.js.map +1 -0
  178. package/resources/x/sports.mjs +72 -0
  179. package/resources/x/sports.mjs.map +1 -0
  180. package/resources/x/tweets/tweets.d.mts +32 -24
  181. package/resources/x/tweets/tweets.d.mts.map +1 -1
  182. package/resources/x/tweets/tweets.d.ts +32 -24
  183. package/resources/x/tweets/tweets.d.ts.map +1 -1
  184. package/resources/x/tweets/tweets.js.map +1 -1
  185. package/resources/x/tweets/tweets.mjs.map +1 -1
  186. package/resources/x/users/users.d.mts +62 -614
  187. package/resources/x/users/users.d.mts.map +1 -1
  188. package/resources/x/users/users.d.ts +62 -614
  189. package/resources/x/users/users.d.ts.map +1 -1
  190. package/resources/x/users/users.js.map +1 -1
  191. package/resources/x/users/users.mjs.map +1 -1
  192. package/resources/x/x.d.mts +63 -118
  193. package/resources/x/x.d.mts.map +1 -1
  194. package/resources/x/x.d.ts +63 -118
  195. package/resources/x/x.d.ts.map +1 -1
  196. package/resources/x/x.js +4 -0
  197. package/resources/x/x.js.map +1 -1
  198. package/resources/x/x.mjs +4 -0
  199. package/resources/x/x.mjs.map +1 -1
  200. package/skills/x-twitter-scraper/references/api-endpoints-x-api.md +1 -0
  201. package/src/client.ts +12 -0
  202. package/src/internal/detect-platform.ts +2 -2
  203. package/src/internal/uploads.ts +1 -1
  204. package/src/resources/account.ts +6 -0
  205. package/src/resources/compose.ts +1 -1
  206. package/src/resources/drafts.ts +14 -2
  207. package/src/resources/events.ts +137 -29
  208. package/src/resources/index.ts +2 -0
  209. package/src/resources/monitors/index.ts +21 -0
  210. package/src/resources/monitors/keywords.ts +15 -79
  211. package/src/resources/monitors/monitors.ts +52 -3
  212. package/src/resources/monitors/posts.ts +463 -0
  213. package/src/resources/shared.ts +897 -215
  214. package/src/resources/support/index.ts +1 -0
  215. package/src/resources/support/support.ts +2 -0
  216. package/src/resources/support/tickets.ts +29 -25
  217. package/src/resources/webhooks.ts +11 -4
  218. package/src/resources/x/accounts.ts +19 -4
  219. package/src/resources/x/broadcasts.ts +3 -154
  220. package/src/resources/x/communities/communities.ts +113 -0
  221. package/src/resources/x/communities/index.ts +3 -0
  222. package/src/resources/x/community-notes.ts +137 -582
  223. package/src/resources/x/index.ts +62 -0
  224. package/src/resources/x/jobs.ts +160 -324
  225. package/src/resources/x/lists.ts +27 -499
  226. package/src/resources/x/media.ts +15 -2
  227. package/src/resources/x/profile.ts +15 -4
  228. package/src/resources/x/spaces.ts +227 -787
  229. package/src/resources/x/sports.ts +1675 -0
  230. package/src/resources/x/tweets/tweets.ts +41 -26
  231. package/src/resources/x/users/users.ts +62 -721
  232. package/src/resources/x/x.ts +185 -128
  233. package/src/version.ts +1 -1
  234. package/version.d.mts +1 -1
  235. package/version.d.ts +1 -1
  236. package/version.js +1 -1
  237. package/version.mjs +1 -1
  238. package/src/lib/.keep +0 -2
@@ -26,7 +26,7 @@ export class Keywords extends APIResource {
26
26
  * });
27
27
  * ```
28
28
  */
29
- create(body: KeywordCreateParams, options?: RequestOptions): APIPromise<KeywordCreateResponse> {
29
+ create(body: KeywordCreateParams, options?: RequestOptions): APIPromise<KeywordMonitor> {
30
30
  return this._client.post('/monitors/keywords', { body, ...options });
31
31
  }
32
32
 
@@ -40,7 +40,7 @@ export class Keywords extends APIResource {
40
40
  * );
41
41
  * ```
42
42
  */
43
- retrieve(id: string, options?: RequestOptions): APIPromise<KeywordRetrieveResponse> {
43
+ retrieve(id: string, options?: RequestOptions): APIPromise<KeywordMonitor> {
44
44
  return this._client.get(path`/monitors/keywords/${id}`, options);
45
45
  }
46
46
 
@@ -59,7 +59,7 @@ export class Keywords extends APIResource {
59
59
  * );
60
60
  * ```
61
61
  */
62
- update(id: string, body: KeywordUpdateParams, options?: RequestOptions): APIPromise<KeywordUpdateResponse> {
62
+ update(id: string, body: KeywordUpdateParams, options?: RequestOptions): APIPromise<KeywordMonitor> {
63
63
  return this._client.patch(path`/monitors/keywords/${id}`, { body, ...options });
64
64
  }
65
65
 
@@ -97,7 +97,7 @@ export class Keywords extends APIResource {
97
97
  /**
98
98
  * Keyword monitor that tracks matching public X activity.
99
99
  */
100
- export interface KeywordCreateResponse {
100
+ export interface KeywordMonitor {
101
101
  id: string;
102
102
 
103
103
  createdAt: string;
@@ -120,68 +120,29 @@ export interface KeywordCreateResponse {
120
120
  * Customer-set label of the keyword monitor, when set.
121
121
  */
122
122
  name?: string;
123
- }
124
-
125
- /**
126
- * Keyword monitor that tracks matching public X activity.
127
- */
128
- export interface KeywordRetrieveResponse {
129
- id: string;
130
-
131
- createdAt: string;
132
123
 
133
124
  /**
134
- * Array of event types to subscribe to.
125
+ * When Xquik paused this keyword monitor.
135
126
  */
136
- eventTypes: Array<Shared.EventType>;
137
-
138
- isActive: boolean;
127
+ pausedAt?: string;
139
128
 
140
129
  /**
141
- * Next hourly credit charge time for this keyword query monitor.
130
+ * Why Xquik paused this keyword monitor. The balance could not pay an hour, so add
131
+ * credits & resume. Absent when the monitor is active or you paused it yourself.
142
132
  */
143
- nextBillingAt: string;
144
-
145
- query: string;
146
-
147
- /**
148
- * Customer-set label of the keyword monitor, when set.
149
- */
150
- name?: string;
133
+ pausedReason?: 'insufficient_credits';
151
134
  }
152
135
 
153
- /**
154
- * Keyword monitor that tracks matching public X activity.
155
- */
156
- export interface KeywordUpdateResponse {
157
- id: string;
158
-
159
- createdAt: string;
160
-
161
- /**
162
- * Array of event types to subscribe to.
163
- */
164
- eventTypes: Array<Shared.EventType>;
165
-
166
- isActive: boolean;
136
+ export type KeywordCreateResponse = KeywordMonitor;
167
137
 
168
- /**
169
- * Next hourly credit charge time for this keyword query monitor.
170
- */
171
- nextBillingAt: string;
138
+ export type KeywordRetrieveResponse = KeywordMonitor;
172
139
 
173
- query: string;
174
-
175
- /**
176
- * Customer-set label of the keyword monitor, when set.
177
- */
178
- name?: string;
179
- }
140
+ export type KeywordUpdateResponse = KeywordMonitor;
180
141
 
181
142
  export interface KeywordListResponse {
182
143
  hasMore: boolean;
183
144
 
184
- monitors: Array<KeywordListResponse.Monitor>;
145
+ monitors: Array<KeywordMonitor>;
185
146
 
186
147
  /**
187
148
  * Keyword monitors on this page.
@@ -192,33 +153,7 @@ export interface KeywordListResponse {
192
153
  }
193
154
 
194
155
  export namespace KeywordListResponse {
195
- /**
196
- * Keyword monitor that tracks matching public X activity.
197
- */
198
- export interface Monitor {
199
- id: string;
200
-
201
- createdAt: string;
202
-
203
- /**
204
- * Array of event types to subscribe to.
205
- */
206
- eventTypes: Array<Shared.EventType>;
207
-
208
- isActive: boolean;
209
-
210
- /**
211
- * Next hourly credit charge time for this keyword query monitor.
212
- */
213
- nextBillingAt: string;
214
-
215
- query: string;
216
-
217
- /**
218
- * Customer-set label of the keyword monitor, when set.
219
- */
220
- name?: string;
221
- }
156
+ export type Monitor = KeywordMonitor;
222
157
  }
223
158
 
224
159
  export interface KeywordDeactivateResponse {
@@ -279,6 +214,7 @@ export interface KeywordListParams {
279
214
 
280
215
  export declare namespace Keywords {
281
216
  export {
217
+ type KeywordMonitor as KeywordMonitor,
282
218
  type KeywordCreateResponse as KeywordCreateResponse,
283
219
  type KeywordRetrieveResponse as KeywordRetrieveResponse,
284
220
  type KeywordUpdateResponse as KeywordUpdateResponse,
@@ -4,6 +4,27 @@
4
4
 
5
5
  import { APIResource } from '../../core/resource';
6
6
  import * as Shared from '../shared';
7
+ import * as PostsAPI from './posts';
8
+ import {
9
+ PostCreateParams,
10
+ PostDeleteResponse,
11
+ PostEventType,
12
+ PostListParams,
13
+ MonitorPostDeleted,
14
+ MonitorPostEdit,
15
+ MonitorPostMetricChange,
16
+ PostListResponse,
17
+ PostMetricPoint,
18
+ PostMetricReading,
19
+ PostMetrics,
20
+ PostMonitor,
21
+ PostMonitorMetrics,
22
+ PostMonitorMetricsBucket,
23
+ PostMonitorMetricsBucketMetrics,
24
+ PostRetrieveMetricsParams,
25
+ PostUpdateParams,
26
+ Posts,
27
+ } from './posts';
7
28
  import * as KeywordsAPI from './keywords';
8
29
  import {
9
30
  KeywordCreateParams,
@@ -11,6 +32,7 @@ import {
11
32
  KeywordDeactivateResponse,
12
33
  KeywordListParams,
13
34
  KeywordListResponse,
35
+ KeywordMonitor,
14
36
  KeywordRetrieveResponse,
15
37
  KeywordUpdateParams,
16
38
  KeywordUpdateResponse,
@@ -25,6 +47,7 @@ import { path } from '../../internal/utils/path';
25
47
  */
26
48
  export class Monitors extends APIResource {
27
49
  keywords: KeywordsAPI.Keywords = new KeywordsAPI.Keywords(this._client);
50
+ posts: PostsAPI.Posts = new PostsAPI.Posts(this._client);
28
51
 
29
52
  /**
30
53
  * Creates an account monitor, with no count limit. Active monitors check every
@@ -131,14 +154,17 @@ export interface Monitor {
131
154
  name?: string;
132
155
 
133
156
  /**
134
- * When Xquik automatically paused this monitor.
157
+ * When Xquik paused this account monitor.
135
158
  */
136
159
  pausedAt?: string;
137
160
 
138
161
  /**
139
- * Why Xquik automatically paused this monitor.
162
+ * Why Xquik paused this account monitor. `insufficient_credits` means the balance
163
+ * could not pay an hour, so add credits & resume. The other 2 mean X stopped
164
+ * showing the account. Absent when the monitor is active or you paused it
165
+ * yourself.
140
166
  */
141
- pausedReason?: 'x_account_protected' | 'x_user_not_found';
167
+ pausedReason?: 'insufficient_credits' | 'x_account_protected' | 'x_user_not_found';
142
168
  }
143
169
 
144
170
  export interface MonitorCreateResponse {
@@ -234,6 +260,7 @@ export interface MonitorListParams {
234
260
  }
235
261
 
236
262
  Monitors.Keywords = Keywords;
263
+ Monitors.Posts = Posts;
237
264
 
238
265
  export declare namespace Monitors {
239
266
  export {
@@ -248,6 +275,7 @@ export declare namespace Monitors {
248
275
 
249
276
  export {
250
277
  Keywords as Keywords,
278
+ type KeywordMonitor as KeywordMonitor,
251
279
  type KeywordCreateResponse as KeywordCreateResponse,
252
280
  type KeywordRetrieveResponse as KeywordRetrieveResponse,
253
281
  type KeywordUpdateResponse as KeywordUpdateResponse,
@@ -257,4 +285,25 @@ export declare namespace Monitors {
257
285
  type KeywordUpdateParams as KeywordUpdateParams,
258
286
  type KeywordListParams as KeywordListParams,
259
287
  };
288
+
289
+ export {
290
+ Posts as Posts,
291
+ type PostEventType as PostEventType,
292
+ type PostMetricReading as PostMetricReading,
293
+ type PostMetrics as PostMetrics,
294
+ type PostMonitor as PostMonitor,
295
+ type PostMetricPoint as PostMetricPoint,
296
+ type PostMonitorMetricsBucketMetrics as PostMonitorMetricsBucketMetrics,
297
+ type PostMonitorMetricsBucket as PostMonitorMetricsBucket,
298
+ type PostMonitorMetrics as PostMonitorMetrics,
299
+ type MonitorPostMetricChange as MonitorPostMetricChange,
300
+ type MonitorPostEdit as MonitorPostEdit,
301
+ type MonitorPostDeleted as MonitorPostDeleted,
302
+ type PostListResponse as PostListResponse,
303
+ type PostDeleteResponse as PostDeleteResponse,
304
+ type PostCreateParams as PostCreateParams,
305
+ type PostUpdateParams as PostUpdateParams,
306
+ type PostListParams as PostListParams,
307
+ type PostRetrieveMetricsParams as PostRetrieveMetricsParams,
308
+ };
260
309
  }
@@ -0,0 +1,463 @@
1
+ // SPDX-FileCopyrightText: 2026 Xquik contributors
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ import { APIResource } from '../../core/resource';
6
+ import { APIPromise } from '../../core/api-promise';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+
10
+ /**
11
+ * Post monitoring with replies, quotes, edits, deletion & 6 metrics
12
+ */
13
+ export class Posts extends APIResource {
14
+ /**
15
+ * Creates a monitor for 1 X post. It tracks replies, quotes, edits, deletion
16
+ * & 6 metrics, for 30 credits an hour with events & webhook deliveries
17
+ * included. That hourly price is a monitor's only charge. Creation needs the
18
+ * credits of the first hour & reads the post once.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const postMonitor = await client.monitors.posts.create({
23
+ * post: 'https://x.com/xquik/status/2104984505677430978',
24
+ * });
25
+ * ```
26
+ */
27
+ create(body: PostCreateParams, options?: RequestOptions): APIPromise<PostMonitor> {
28
+ return this._client.post('/monitors/posts', { body, ...options });
29
+ }
30
+
31
+ /**
32
+ * Returns 1 post monitor with its post & the 6 metrics, each with its current
33
+ * value & gain since tracking began.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const postMonitor = await client.monitors.posts.retrieve('id');
38
+ * ```
39
+ */
40
+ retrieve(id: string, options?: RequestOptions): APIPromise<PostMonitor> {
41
+ return this._client.get(path`/monitors/posts/${id}`, options);
42
+ }
43
+
44
+ /**
45
+ * Updates a post monitor's label, event types or active state. Turning a
46
+ * paused monitor on reads the post first, & answers 409 while X hides it.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const postMonitor = await client.monitors.posts.update('id', {
51
+ * isActive: false,
52
+ * });
53
+ * ```
54
+ */
55
+ update(id: string, body: PostUpdateParams, options?: RequestOptions): APIPromise<PostMonitor> {
56
+ return this._client.patch(path`/monitors/posts/${id}`, { body, ...options });
57
+ }
58
+
59
+ /**
60
+ * Returns post monitors with each post's 6 metrics, their current values &
61
+ * gains since tracking began.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const posts = await client.monitors.posts.list();
66
+ * ```
67
+ */
68
+ list(
69
+ query: PostListParams | null | undefined = {},
70
+ options?: RequestOptions,
71
+ ): APIPromise<PostListResponse> {
72
+ return this._client.get('/monitors/posts', { query, ...options });
73
+ }
74
+
75
+ /**
76
+ * Stops 1 post monitor, then removes its stored events & metric history in
77
+ * bounded batches. Poll statusUrl until the monitor returns 404.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const post = await client.monitors.posts.delete('id');
82
+ * ```
83
+ */
84
+ delete(id: string, options?: RequestOptions): APIPromise<PostDeleteResponse> {
85
+ return this._client.delete(path`/monitors/posts/${id}`, options);
86
+ }
87
+
88
+ /**
89
+ * Returns 1 bucket per hour with each metric's value at the hour's end & its
90
+ * gain over that hour. The last bucket is the current hour. Hours before
91
+ * tracking began carry the starting values with a gain of 0.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const postMonitorMetrics = await client.monitors.posts.retrieveMetrics('id');
96
+ * ```
97
+ */
98
+ retrieveMetrics(
99
+ id: string,
100
+ query: PostRetrieveMetricsParams | null | undefined = {},
101
+ options?: RequestOptions,
102
+ ): APIPromise<PostMonitorMetrics> {
103
+ return this._client.get(path`/monitors/posts/${id}/metrics`, { query, ...options });
104
+ }
105
+ }
106
+
107
+ /**
108
+ * A post event type.
109
+ */
110
+ export type PostEventType =
111
+ | 'post.reply.new'
112
+ | 'post.quote.new'
113
+ | 'post.likes.changed'
114
+ | 'post.retweets.changed'
115
+ | 'post.replies.changed'
116
+ | 'post.quotes.changed'
117
+ | 'post.bookmarks.changed'
118
+ | 'post.views.changed'
119
+ | 'post.edited'
120
+ | 'post.deleted';
121
+
122
+ /**
123
+ * A metric's current value & its gain since tracking began. Both are null when
124
+ * X shows no count, as for views on old posts.
125
+ */
126
+ export interface PostMetricReading {
127
+ current: number | null;
128
+
129
+ gain: number | null;
130
+ }
131
+
132
+ /**
133
+ * The 6 metrics of a post.
134
+ */
135
+ export interface PostMetrics {
136
+ /**
137
+ * A metric's current value & its gain since tracking began. Both are null
138
+ * when X shows no count, as for views on old posts.
139
+ */
140
+ views: PostMetricReading;
141
+
142
+ /**
143
+ * A metric's current value & its gain since tracking began. Both are null
144
+ * when X shows no count, as for views on old posts.
145
+ */
146
+ likes: PostMetricReading;
147
+
148
+ /**
149
+ * A metric's current value & its gain since tracking began. Both are null
150
+ * when X shows no count, as for views on old posts.
151
+ */
152
+ retweets: PostMetricReading;
153
+
154
+ /**
155
+ * A metric's current value & its gain since tracking began. Both are null
156
+ * when X shows no count, as for views on old posts.
157
+ */
158
+ replies: PostMetricReading;
159
+
160
+ /**
161
+ * A metric's current value & its gain since tracking began. Both are null
162
+ * when X shows no count, as for views on old posts.
163
+ */
164
+ quotes: PostMetricReading;
165
+
166
+ /**
167
+ * A metric's current value & its gain since tracking began. Both are null
168
+ * when X shows no count, as for views on old posts.
169
+ */
170
+ bookmarks: PostMetricReading;
171
+ }
172
+
173
+ /**
174
+ * Post monitor that tracks 1 X post's replies, quotes, edits & metrics.
175
+ */
176
+ export interface PostMonitor {
177
+ id: string;
178
+
179
+ /**
180
+ * ID of the post you gave.
181
+ */
182
+ postId: string;
183
+
184
+ postUrl: string;
185
+
186
+ /**
187
+ * Permanent X user ID of the post's author.
188
+ */
189
+ authorId: string;
190
+
191
+ authorUsername: string;
192
+
193
+ authorName: string;
194
+
195
+ /**
196
+ * Text of the newest version Xquik read.
197
+ */
198
+ text: string;
199
+
200
+ postedAt: string;
201
+
202
+ /**
203
+ * Post event types to send. Without it, a monitor sends new replies, new
204
+ * quotes, like & retweet changes, edits & deletion.
205
+ */
206
+ eventTypes: Array<PostEventType>;
207
+
208
+ isActive: boolean;
209
+
210
+ createdAt: string;
211
+
212
+ /**
213
+ * Next hourly credit charge time for this post monitor.
214
+ */
215
+ nextBillingAt: string;
216
+
217
+ /**
218
+ * The 6 metrics of a post.
219
+ */
220
+ metrics: PostMetrics;
221
+
222
+ /**
223
+ * Customer-set label of the post monitor, when set.
224
+ */
225
+ name?: string;
226
+
227
+ /**
228
+ * Why Xquik paused this post monitor. insufficient_credits means the balance
229
+ * could not pay an hour, so add credits & resume. The other 3 mean X stopped
230
+ * showing the post. Absent when the monitor is active or you paused it
231
+ * yourself.
232
+ */
233
+ pausedReason?: 'insufficient_credits' | 'x_post_deleted' | 'x_post_protected' | 'x_post_unavailable';
234
+
235
+ /**
236
+ * When Xquik paused this post monitor.
237
+ */
238
+ pausedAt?: string;
239
+ }
240
+
241
+ /**
242
+ * A metric's value at the hour's end & its gain over that hour. Both are null
243
+ * when X shows no count.
244
+ */
245
+ export interface PostMetricPoint {
246
+ value: number | null;
247
+
248
+ gain: number | null;
249
+ }
250
+
251
+ export interface PostMonitorMetricsBucketMetrics {
252
+ /**
253
+ * A metric's value at the hour's end & its gain over that hour. Both are null
254
+ * when X shows no count.
255
+ */
256
+ views: PostMetricPoint;
257
+
258
+ /**
259
+ * A metric's value at the hour's end & its gain over that hour. Both are null
260
+ * when X shows no count.
261
+ */
262
+ likes: PostMetricPoint;
263
+
264
+ /**
265
+ * A metric's value at the hour's end & its gain over that hour. Both are null
266
+ * when X shows no count.
267
+ */
268
+ retweets: PostMetricPoint;
269
+
270
+ /**
271
+ * A metric's value at the hour's end & its gain over that hour. Both are null
272
+ * when X shows no count.
273
+ */
274
+ replies: PostMetricPoint;
275
+
276
+ /**
277
+ * A metric's value at the hour's end & its gain over that hour. Both are null
278
+ * when X shows no count.
279
+ */
280
+ quotes: PostMetricPoint;
281
+
282
+ /**
283
+ * A metric's value at the hour's end & its gain over that hour. Both are null
284
+ * when X shows no count.
285
+ */
286
+ bookmarks: PostMetricPoint;
287
+ }
288
+
289
+ export interface PostMonitorMetricsBucket {
290
+ /**
291
+ * Start of the hour.
292
+ */
293
+ at: string;
294
+
295
+ metrics: PostMonitorMetricsBucketMetrics;
296
+ }
297
+
298
+ /**
299
+ * Hourly metric buckets of 1 post monitor, oldest first.
300
+ */
301
+ export interface PostMonitorMetrics {
302
+ hours: number;
303
+
304
+ buckets: Array<PostMonitorMetricsBucket>;
305
+ }
306
+
307
+ /**
308
+ * A post metric's change since its last event, on post.likes.changed,
309
+ * post.retweets.changed, post.replies.changed, post.quotes.changed,
310
+ * post.bookmarks.changed & post.views.changed.
311
+ */
312
+ export interface MonitorPostMetricChange {
313
+ /**
314
+ * Current count minus previous count.
315
+ */
316
+ change: number;
317
+
318
+ /**
319
+ * The count X shows now.
320
+ */
321
+ current: number;
322
+
323
+ /**
324
+ * The metric that changed.
325
+ */
326
+ metric: 'bookmarks' | 'likes' | 'quotes' | 'replies' | 'retweets' | 'views';
327
+
328
+ /**
329
+ * The count the last event of this metric reported.
330
+ */
331
+ previous: number;
332
+ }
333
+
334
+ /**
335
+ * The post's text before & after an edit, on post.edited.
336
+ */
337
+ export interface MonitorPostEdit {
338
+ /**
339
+ * The text before the edit.
340
+ */
341
+ previousText: string;
342
+
343
+ /**
344
+ * The text of the newest version.
345
+ */
346
+ text: string;
347
+
348
+ /**
349
+ * X's ID of the newest version of the post.
350
+ */
351
+ versionId: string;
352
+ }
353
+
354
+ /**
355
+ * The last text the monitor saw, on post.deleted.
356
+ */
357
+ export interface MonitorPostDeleted {
358
+ /**
359
+ * The post's text before its author deleted it.
360
+ */
361
+ text: string;
362
+ }
363
+
364
+ export interface PostListResponse {
365
+ hasMore: boolean;
366
+
367
+ monitors: Array<PostMonitor>;
368
+
369
+ /**
370
+ * Post monitors on this page.
371
+ */
372
+ total: number;
373
+
374
+ nextCursor?: string;
375
+ }
376
+
377
+ export interface PostDeleteResponse {
378
+ deletionStatus: 'deleting';
379
+
380
+ /**
381
+ * Poll this monitor URL until it returns 404.
382
+ */
383
+ statusUrl: string;
384
+
385
+ success: true;
386
+ }
387
+
388
+ export interface PostCreateParams {
389
+ /**
390
+ * Post link or ID. x.com, twitter.com, mobile & /i/web/status/ links work
391
+ * with any query string.
392
+ */
393
+ post: string;
394
+
395
+ /**
396
+ * Post event types to send. Without it, a monitor sends new replies, new
397
+ * quotes, like & retweet changes, edits & deletion.
398
+ */
399
+ eventTypes?: Array<PostEventType>;
400
+
401
+ /**
402
+ * Your own label for the post monitor. Its events carry it as monitorName.
403
+ */
404
+ name?: string | null;
405
+ }
406
+
407
+ export interface PostUpdateParams {
408
+ /**
409
+ * Post event types to send. Without it, a monitor sends new replies, new
410
+ * quotes, like & retweet changes, edits & deletion.
411
+ */
412
+ eventTypes?: Array<PostEventType>;
413
+
414
+ isActive?: boolean;
415
+
416
+ /**
417
+ * New label for the post monitor. Send null to remove it.
418
+ */
419
+ name?: string | null;
420
+ }
421
+
422
+ export interface PostListParams {
423
+ /**
424
+ * Previous nextCursor. The after alias also works. Offset pagination is not
425
+ * supported.
426
+ */
427
+ cursor?: string;
428
+
429
+ /**
430
+ * Maximum items per page, from 1 to 200. Default 200. Pass nextCursor as
431
+ * cursor for the next page.
432
+ */
433
+ limit?: number;
434
+ }
435
+
436
+ export interface PostRetrieveMetricsParams {
437
+ /**
438
+ * Hours to return, from 1 to 720.
439
+ */
440
+ hours?: number;
441
+ }
442
+
443
+ export declare namespace Posts {
444
+ export {
445
+ type PostEventType as PostEventType,
446
+ type PostMetricReading as PostMetricReading,
447
+ type PostMetrics as PostMetrics,
448
+ type PostMonitor as PostMonitor,
449
+ type PostMetricPoint as PostMetricPoint,
450
+ type PostMonitorMetricsBucketMetrics as PostMonitorMetricsBucketMetrics,
451
+ type PostMonitorMetricsBucket as PostMonitorMetricsBucket,
452
+ type PostMonitorMetrics as PostMonitorMetrics,
453
+ type MonitorPostMetricChange as MonitorPostMetricChange,
454
+ type MonitorPostEdit as MonitorPostEdit,
455
+ type MonitorPostDeleted as MonitorPostDeleted,
456
+ type PostListResponse as PostListResponse,
457
+ type PostDeleteResponse as PostDeleteResponse,
458
+ type PostCreateParams as PostCreateParams,
459
+ type PostUpdateParams as PostUpdateParams,
460
+ type PostListParams as PostListParams,
461
+ type PostRetrieveMetricsParams as PostRetrieveMetricsParams,
462
+ };
463
+ }