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
@@ -6,6 +6,7 @@ export { Attachments, type AttachmentDownloadParams } from './attachments';
6
6
  export { Support } from './support';
7
7
  export {
8
8
  Tickets,
9
+ type SupportReceipt,
9
10
  type TicketCreateResponse,
10
11
  type TicketRetrieveResponse,
11
12
  type TicketUpdateResponse,
@@ -7,6 +7,7 @@ import * as AttachmentsAPI from './attachments';
7
7
  import { AttachmentDownloadParams, Attachments } from './attachments';
8
8
  import * as TicketsAPI from './tickets';
9
9
  import {
10
+ SupportReceipt,
10
11
  TicketCreateParams,
11
12
  TicketCreateResponse,
12
13
  TicketListParams,
@@ -32,6 +33,7 @@ export declare namespace Support {
32
33
 
33
34
  export {
34
35
  Tickets as Tickets,
36
+ type SupportReceipt as SupportReceipt,
35
37
  type TicketCreateResponse as TicketCreateResponse,
36
38
  type TicketRetrieveResponse as TicketRetrieveResponse,
37
39
  type TicketUpdateResponse as TicketUpdateResponse,
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { APIResource } from '../../core/resource';
6
6
  import { APIPromise } from '../../core/api-promise';
7
+ import { type Uploadable } from '../../core/uploads';
7
8
  import { buildHeaders } from '../../internal/headers';
8
9
  import { RequestOptions } from '../../internal/request-options';
9
10
  import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
@@ -24,7 +25,7 @@ export class Tickets extends APIResource {
24
25
  * });
25
26
  * ```
26
27
  */
27
- create(params: TicketCreateParams, options?: RequestOptions): APIPromise<TicketCreateResponse> {
28
+ create(params: TicketCreateParams, options?: RequestOptions): APIPromise<SupportReceipt> {
28
29
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
29
30
  return this._client.post(
30
31
  '/support/tickets',
@@ -97,7 +98,7 @@ export class Tickets extends APIResource {
97
98
  * );
98
99
  * ```
99
100
  */
100
- reply(id: string, params: TicketReplyParams, options?: RequestOptions): APIPromise<TicketReplyResponse> {
101
+ reply(id: string, params: TicketReplyParams, options?: RequestOptions): APIPromise<SupportReceipt> {
101
102
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
102
103
  return this._client.post(
103
104
  path`/support/tickets/${id}/messages`,
@@ -119,13 +120,13 @@ export class Tickets extends APIResource {
119
120
  /**
120
121
  * Support submission receipt.
121
122
  */
122
- export interface TicketCreateResponse {
123
- attachments: Array<TicketCreateResponse.Attachment>;
123
+ export interface SupportReceipt {
124
+ attachments: Array<SupportReceipt.Attachment>;
124
125
 
125
126
  publicId: string;
126
127
  }
127
128
 
128
- export namespace TicketCreateResponse {
129
+ export namespace SupportReceipt {
129
130
  /**
130
131
  * Attachment identifier and initial processing state.
131
132
  */
@@ -136,6 +137,12 @@ export namespace TicketCreateResponse {
136
137
  }
137
138
  }
138
139
 
140
+ export type TicketCreateResponse = SupportReceipt;
141
+
142
+ export namespace TicketCreateResponse {
143
+ export type Attachment = SupportReceipt.Attachment;
144
+ }
145
+
139
146
  export interface TicketRetrieveResponse {
140
147
  createdAt: string;
141
148
 
@@ -229,36 +236,27 @@ export namespace TicketListResponse {
229
236
  }
230
237
  }
231
238
 
232
- /**
233
- * Support submission receipt.
234
- */
235
- export interface TicketReplyResponse {
236
- attachments: Array<TicketReplyResponse.Attachment>;
239
+ export type TicketReplyResponse = SupportReceipt;
237
240
 
238
- publicId: string;
241
+ export namespace TicketReplyResponse {
242
+ export type Attachment = SupportReceipt.Attachment;
239
243
  }
240
244
 
241
- export namespace TicketReplyResponse {
245
+ export interface TicketCreateParams {
242
246
  /**
243
- * Attachment identifier and initial processing state.
247
+ * Body param: Non-empty support ticket subject.
244
248
  */
245
- export interface Attachment {
246
- publicId: string;
247
-
248
- status: 'pending' | 'ready' | 'failed';
249
- }
250
- }
249
+ subject: string;
251
250
 
252
- export interface TicketCreateParams {
253
251
  /**
254
- * Body param: Non-empty support message text.
252
+ * Body param: 1 to 4 support image or video uploads.
255
253
  */
256
- body: string;
254
+ attachments?: Array<Uploadable>;
257
255
 
258
256
  /**
259
- * Body param: Non-empty support ticket subject.
257
+ * Body param: Non-empty support message text.
260
258
  */
261
- subject: string;
259
+ body?: string;
262
260
 
263
261
  /**
264
262
  * Header param: Generate one random value per ticket or reply. Reuse it only when
@@ -286,10 +284,15 @@ export interface TicketListParams {
286
284
  }
287
285
 
288
286
  export interface TicketReplyParams {
287
+ /**
288
+ * Body param: 1 to 4 support image or video uploads.
289
+ */
290
+ attachments?: Array<Uploadable>;
291
+
289
292
  /**
290
293
  * Body param: Non-empty support message text.
291
294
  */
292
- body: string;
295
+ body?: string;
293
296
 
294
297
  /**
295
298
  * Header param: Generate one random value per ticket or reply. Reuse it only when
@@ -300,6 +303,7 @@ export interface TicketReplyParams {
300
303
 
301
304
  export declare namespace Tickets {
302
305
  export {
306
+ type SupportReceipt as SupportReceipt,
303
307
  type TicketCreateResponse as TicketCreateResponse,
304
308
  type TicketRetrieveResponse as TicketRetrieveResponse,
305
309
  type TicketUpdateResponse as TicketUpdateResponse,
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { APIResource } from '../core/resource';
6
6
  import * as Shared from './shared';
7
+ import * as PostsAPI from './monitors/posts';
7
8
  import { APIPromise } from '../core/api-promise';
8
9
  import { RequestOptions } from '../internal/request-options';
9
10
  import { path } from '../internal/utils/path';
@@ -179,7 +180,7 @@ export interface Webhook {
179
180
  /**
180
181
  * Array of event types to subscribe to.
181
182
  */
182
- eventTypes: Array<Shared.EventType>;
183
+ eventTypes: Array<Shared.EventType | PostsAPI.PostEventType>;
183
184
 
184
185
  /**
185
186
  * Maximum reported failures before needs_attention. It does not pause delivery.
@@ -199,7 +200,7 @@ export interface WebhookCreateResponse {
199
200
  /**
200
201
  * Array of event types to subscribe to.
201
202
  */
202
- eventTypes: Array<Shared.EventType>;
203
+ eventTypes: Array<Shared.EventType | PostsAPI.PostEventType>;
203
204
 
204
205
  /**
205
206
  * Plaintext HMAC signing secret returned only at creation.
@@ -207,6 +208,12 @@ export interface WebhookCreateResponse {
207
208
  secret: string;
208
209
 
209
210
  url: string;
211
+
212
+ /**
213
+ * Fields the request sent that this route does not read, in the order sent. They
214
+ * changed nothing. The answer leaves this out when the route read every field.
215
+ */
216
+ ignoredFields?: Array<string>;
210
217
  }
211
218
 
212
219
  export interface WebhookListResponse {
@@ -264,7 +271,7 @@ export interface WebhookCreateParams {
264
271
  /**
265
272
  * Array of event types to subscribe to.
266
273
  */
267
- eventTypes: Array<Shared.EventType>;
274
+ eventTypes: Array<Shared.EventType | PostsAPI.PostEventType>;
268
275
 
269
276
  /**
270
277
  * HTTPS URL. A Discord channel webhook URL gets each event as a Discord message, &
@@ -278,7 +285,7 @@ export interface WebhookUpdateParams {
278
285
  /**
279
286
  * Array of event types to subscribe to.
280
287
  */
281
- eventTypes?: Array<Shared.EventType>;
288
+ eventTypes?: Array<Shared.EventType | PostsAPI.PostEventType>;
282
289
 
283
290
  isActive?: boolean;
284
291
 
@@ -71,16 +71,21 @@ export class Accounts extends APIResource {
71
71
  }
72
72
 
73
73
  /**
74
- * Clears loginFailedAt and loginFailureReason for all accounts with transient or
75
- * automated failure reasons, making them eligible for retry on next use.
74
+ * Clears loginFailedAt and loginFailureReason for every account with a transient
75
+ * or automated failure reason. Each can then retry on its next use. Name accounts
76
+ * in accountIds to retry only those. Needs a dashboard session, since each retry
77
+ * signs in to X again.
76
78
  *
77
79
  * @example
78
80
  * ```ts
79
81
  * const response = await client.x.accounts.bulkRetry();
80
82
  * ```
81
83
  */
82
- bulkRetry(options?: RequestOptions): APIPromise<AccountBulkRetryResponse> {
83
- return this._client.post('/x/accounts/bulk-retry', options);
84
+ bulkRetry(
85
+ body: AccountBulkRetryParams | null | undefined = {},
86
+ options?: RequestOptions,
87
+ ): APIPromise<AccountBulkRetryResponse> {
88
+ return this._client.post('/x/accounts/bulk-retry', { body, ...options });
84
89
  }
85
90
 
86
91
  /**
@@ -290,6 +295,15 @@ export interface AccountListParams {
290
295
  limit?: number;
291
296
  }
292
297
 
298
+ export interface AccountBulkRetryParams {
299
+ /**
300
+ * IDs of the X accounts to retry. Accounts that failed for another reason, or
301
+ * belong to someone else, stay as they are. Accepts 1 to 1,000 IDs. Omit accountIds
302
+ * to retry every account with a transient or automated failure.
303
+ */
304
+ accountIds?: Array<string>;
305
+ }
306
+
293
307
  export interface AccountReauthParams {
294
308
  /**
295
309
  * Updated account password
@@ -318,6 +332,7 @@ export declare namespace Accounts {
318
332
  type AccountReauthResponse as AccountReauthResponse,
319
333
  type AccountCreateParams as AccountCreateParams,
320
334
  type AccountListParams as AccountListParams,
335
+ type AccountBulkRetryParams as AccountBulkRetryParams,
321
336
  type AccountReauthParams as AccountReauthParams,
322
337
  };
323
338
  }
@@ -35,165 +35,14 @@ export interface BroadcastRetrieveResponse {
35
35
  /**
36
36
  * X broadcast, a live video
37
37
  */
38
- broadcast: BroadcastRetrieveResponse.Broadcast;
38
+ broadcast: Shared.Broadcast;
39
39
  }
40
40
 
41
41
  export namespace BroadcastRetrieveResponse {
42
- /**
43
- * X broadcast, a live video
44
- */
45
- export interface Broadcast {
46
- /**
47
- * Broadcast ID
48
- */
49
- id: string;
50
-
51
- /**
52
- * Camera rotation in degrees
53
- */
54
- cameraRotation?: number;
55
-
56
- /**
57
- * X's code for who may chat
58
- */
59
- chatOption?: number;
60
-
61
- /**
62
- * Public X profile.
63
- */
64
- creator?: Shared.UserProfile;
65
-
66
- /**
67
- * When the broadcast ended
68
- */
69
- endedAt?: string;
70
-
71
- /**
72
- * Video height in pixels
73
- */
74
- height?: number;
75
-
76
- /**
77
- * Whether X offers a recording of the broadcast
78
- */
79
- isAvailableForReplay?: boolean;
80
-
81
- /**
82
- * Whether the video stream runs in high-latency mode
83
- */
84
- isHighLatency?: boolean;
85
-
86
- /**
87
- * Whether X marks the chat private
88
- */
89
- isPrivateChat?: boolean;
90
-
91
- /**
92
- * Whether the broadcaster edited the title of the replay
93
- */
94
- isTitleEdited?: boolean;
95
-
96
- /**
97
- * When the video stream last reached X
98
- */
99
- lastPingAt?: string;
100
-
101
- /**
102
- * X's media key for the video
103
- */
104
- mediaKey?: string;
105
-
106
- /**
107
- * Broadcaster, as X's live video service names the account
108
- */
109
- periscopeUser?: Broadcast.PeriscopeUser;
110
-
111
- /**
112
- * Image X shows before the broadcast starts
113
- */
114
- preLiveSlateUrl?: string;
115
-
116
- /**
117
- * When the broadcast was set to start
118
- */
119
- scheduledStart?: string;
120
-
121
- /**
122
- * What produced the video stream, as X names it
123
- */
124
- source?: string;
125
-
126
- /**
127
- * When the broadcast went live
128
- */
129
- startedAt?: string;
130
-
131
- /**
132
- * Such as NotStarted, Running or Ended, as X names it
133
- */
134
- state?: string;
135
-
136
- /**
137
- * Broadcast title
138
- */
139
- title?: string;
140
-
141
- /**
142
- * Accounts that watched, live or after
143
- */
144
- totalWatched?: number;
145
-
146
- /**
147
- * Accounts watching, as X counts them
148
- */
149
- totalWatching?: number;
150
-
151
- /**
152
- * Search tweet with author. Zero metrics may mean X omitted counts.
153
- */
154
- tweet?: Shared.SearchTweet;
155
-
156
- /**
157
- * ID of the post that announces the broadcast
158
- */
159
- tweetId?: string;
160
-
161
- /**
162
- * X's revision number of the broadcast
163
- */
164
- version?: number;
165
-
166
- /**
167
- * Video width in pixels
168
- */
169
- width?: number;
170
- }
42
+ export type Broadcast = Shared.Broadcast;
171
43
 
172
44
  export namespace Broadcast {
173
- /**
174
- * Broadcaster, as X's live video service names the account
175
- */
176
- export interface PeriscopeUser {
177
- /**
178
- * Live video account ID
179
- */
180
- id?: string;
181
-
182
- /**
183
- * Live video display name
184
- */
185
- displayName?: string;
186
-
187
- /**
188
- * Live video avatar URL
189
- */
190
- profilePicture?: string;
191
-
192
- /**
193
- * Live video username
194
- */
195
- username?: string;
196
- }
45
+ export type PeriscopeUser = Shared.Broadcast.PeriscopeUser;
197
46
  }
198
47
  }
199
48
 
@@ -144,6 +144,25 @@ export class Communities extends APIResource {
144
144
  return this._client.get('/x/communities/topics', { query, ...options });
145
145
  }
146
146
 
147
+ /**
148
+ * Returns community activity for X's latest period. Includes likes, new members,
149
+ * posts, replies & unique posters. Each metric has a count and a changePercent.
150
+ * Each request costs 1 credit.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * const communityAnalytics =
155
+ * await client.x.communities.retrieveAnalytics('id');
156
+ * ```
157
+ */
158
+ retrieveAnalytics(
159
+ id: string,
160
+ query: CommunityRetrieveAnalyticsParams | null | undefined = {},
161
+ options?: RequestOptions,
162
+ ): APIPromise<CommunityAnalytics> {
163
+ return this._client.get(path`/x/communities/${id}/analytics`, { query, ...options });
164
+ }
165
+
147
166
  /**
148
167
  * Returns one community's public identity, rules, join question, search tags,
149
168
  * membership counts, and the profiles of its creator, admin and previewed members.
@@ -238,6 +257,79 @@ export class Communities extends APIResource {
238
257
  }
239
258
  }
240
259
 
260
+ /**
261
+ * Community activity & growth for X's latest period.
262
+ */
263
+ export interface CommunityAnalytics {
264
+ /**
265
+ * The community ID from your request.
266
+ */
267
+ id: string;
268
+
269
+ /**
270
+ * The period's activity, each metric with its count and changePercent. likes
271
+ * counts likes on community posts and newMembers the accounts that joined. posts
272
+ * counts the community posts and replies the replies to them. uniquePosters counts
273
+ * the distinct accounts that posted.
274
+ */
275
+ metrics: CommunityAnalytics.Metrics;
276
+
277
+ /**
278
+ * The end of X's latest period, in UTC.
279
+ */
280
+ periodEndsAt: string;
281
+ }
282
+
283
+ export namespace CommunityAnalytics {
284
+ /**
285
+ * The period's activity, each metric with its count and changePercent. likes
286
+ * counts likes on community posts and newMembers the accounts that joined. posts
287
+ * counts the community posts and replies the replies to them. uniquePosters counts
288
+ * the distinct accounts that posted.
289
+ */
290
+ export interface Metrics {
291
+ /**
292
+ * A community metric for X's latest period & its percent change.
293
+ */
294
+ likes: CommunityAnalyticsMetric;
295
+
296
+ /**
297
+ * A community metric for X's latest period & its percent change.
298
+ */
299
+ newMembers: CommunityAnalyticsMetric;
300
+
301
+ /**
302
+ * A community metric for X's latest period & its percent change.
303
+ */
304
+ posts: CommunityAnalyticsMetric;
305
+
306
+ /**
307
+ * A community metric for X's latest period & its percent change.
308
+ */
309
+ replies: CommunityAnalyticsMetric;
310
+
311
+ /**
312
+ * A community metric for X's latest period & its percent change.
313
+ */
314
+ uniquePosters: CommunityAnalyticsMetric;
315
+ }
316
+ }
317
+
318
+ /**
319
+ * A community metric for X's latest period & its percent change.
320
+ */
321
+ export interface CommunityAnalyticsMetric {
322
+ /**
323
+ * Change in percent from the same figure 1 day earlier. Values stay unrounded.
324
+ */
325
+ changePercent: number;
326
+
327
+ /**
328
+ * Total for this metric during X's latest period.
329
+ */
330
+ count: number;
331
+ }
332
+
241
333
  /**
242
334
  * Durable write record. Poll statusUrl until terminal is true. Reusing its
243
335
  * Idempotency-Key returns this record. Create another action only when safeToRetry
@@ -955,6 +1047,24 @@ export interface CommunityListTopicsParams {
955
1047
  omit?: string;
956
1048
  }
957
1049
 
1050
+ export interface CommunityRetrieveAnalyticsParams {
1051
+ /**
1052
+ * Fields to keep in each row, comma-separated. Use dots for nested fields, such as
1053
+ * author.username. A list keeps the field in each item. Case & underscores do not
1054
+ * matter. A row that lacks a field leaves it out. Cursors, counts & diagnostics
1055
+ * always stay. An unknown name answers 400 unknown_field with the valid names,
1056
+ * before any read. The price stays the same. SDK row types then hold only the
1057
+ * named fields.
1058
+ */
1059
+ fields?: string;
1060
+
1061
+ /**
1062
+ * Fields to drop from each row, comma-separated. It takes the same names as
1063
+ * fields. With fields, it drops from the kept fields.
1064
+ */
1065
+ omit?: string;
1066
+ }
1067
+
958
1068
  export interface CommunityRetrieveInfoParams {
959
1069
  /**
960
1070
  * Fields to keep in each row, comma-separated. Use dots for nested fields, such as
@@ -1561,6 +1671,8 @@ Communities.Media = Media;
1561
1671
 
1562
1672
  export declare namespace Communities {
1563
1673
  export {
1674
+ type CommunityAnalytics as CommunityAnalytics,
1675
+ type CommunityAnalyticsMetric as CommunityAnalyticsMetric,
1564
1676
  type CommunityCreateResponse as CommunityCreateResponse,
1565
1677
  type CommunityDeleteResponse as CommunityDeleteResponse,
1566
1678
  type CommunityListSuggestedResponse as CommunityListSuggestedResponse,
@@ -1572,6 +1684,7 @@ export declare namespace Communities {
1572
1684
  type CommunityListPopularParams as CommunityListPopularParams,
1573
1685
  type CommunityListSuggestedParams as CommunityListSuggestedParams,
1574
1686
  type CommunityListTopicsParams as CommunityListTopicsParams,
1687
+ type CommunityRetrieveAnalyticsParams as CommunityRetrieveAnalyticsParams,
1575
1688
  type CommunityRetrieveInfoParams as CommunityRetrieveInfoParams,
1576
1689
  type CommunityRetrieveMembersParams as CommunityRetrieveMembersParams,
1577
1690
  type CommunityRetrieveModeratorsParams as CommunityRetrieveModeratorsParams,
@@ -4,6 +4,8 @@
4
4
 
5
5
  export {
6
6
  Communities,
7
+ type CommunityAnalytics,
8
+ type CommunityAnalyticsMetric,
7
9
  type CommunityCreateResponse,
8
10
  type CommunityDeleteResponse,
9
11
  type CommunityListSuggestedResponse,
@@ -15,6 +17,7 @@ export {
15
17
  type CommunityListPopularParams,
16
18
  type CommunityListSuggestedParams,
17
19
  type CommunityListTopicsParams,
20
+ type CommunityRetrieveAnalyticsParams,
18
21
  type CommunityRetrieveInfoParams,
19
22
  type CommunityRetrieveMembersParams,
20
23
  type CommunityRetrieveModeratorsParams,