x-twitter-scraper 0.4.1 → 0.5.1

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 (171) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -0
  3. package/client.d.mts +1 -1
  4. package/client.d.ts +1 -1
  5. package/client.js +1 -1
  6. package/client.mjs +1 -1
  7. package/package.json +1 -1
  8. package/resources/account.d.mts +2 -2
  9. package/resources/account.d.ts +2 -2
  10. package/resources/compose.d.mts +186 -65
  11. package/resources/compose.d.mts.map +1 -1
  12. package/resources/compose.d.ts +186 -65
  13. package/resources/compose.d.ts.map +1 -1
  14. package/resources/compose.js +5 -2
  15. package/resources/compose.js.map +1 -1
  16. package/resources/compose.mjs +5 -2
  17. package/resources/compose.mjs.map +1 -1
  18. package/resources/credits.d.mts +1 -1
  19. package/resources/credits.d.ts +1 -1
  20. package/resources/extractions.d.mts +4 -4
  21. package/resources/extractions.d.ts +4 -4
  22. package/resources/guest-wallets.d.mts +2 -2
  23. package/resources/guest-wallets.d.ts +2 -2
  24. package/resources/monitors/keywords.d.mts +4 -4
  25. package/resources/monitors/keywords.d.ts +4 -4
  26. package/resources/monitors/keywords.js +4 -4
  27. package/resources/monitors/keywords.mjs +4 -4
  28. package/resources/monitors/monitors.d.mts +5 -4
  29. package/resources/monitors/monitors.d.mts.map +1 -1
  30. package/resources/monitors/monitors.d.ts +5 -4
  31. package/resources/monitors/monitors.d.ts.map +1 -1
  32. package/resources/monitors/monitors.js +5 -4
  33. package/resources/monitors/monitors.js.map +1 -1
  34. package/resources/monitors/monitors.mjs +5 -4
  35. package/resources/monitors/monitors.mjs.map +1 -1
  36. package/resources/shared.d.mts +24 -8
  37. package/resources/shared.d.mts.map +1 -1
  38. package/resources/shared.d.ts +24 -8
  39. package/resources/shared.d.ts.map +1 -1
  40. package/resources/support/tickets.d.mts +67 -4
  41. package/resources/support/tickets.d.mts.map +1 -1
  42. package/resources/support/tickets.d.ts +67 -4
  43. package/resources/support/tickets.d.ts.map +1 -1
  44. package/resources/support/tickets.js +22 -4
  45. package/resources/support/tickets.js.map +1 -1
  46. package/resources/support/tickets.mjs +22 -4
  47. package/resources/support/tickets.mjs.map +1 -1
  48. package/resources/x/account-connection-challenges.d.mts +1 -1
  49. package/resources/x/account-connection-challenges.d.ts +1 -1
  50. package/resources/x/account-connection-challenges.js +1 -1
  51. package/resources/x/account-connection-challenges.mjs +1 -1
  52. package/resources/x/accounts.d.mts +9 -6
  53. package/resources/x/accounts.d.mts.map +1 -1
  54. package/resources/x/accounts.d.ts +9 -6
  55. package/resources/x/accounts.d.ts.map +1 -1
  56. package/resources/x/accounts.js +4 -2
  57. package/resources/x/accounts.js.map +1 -1
  58. package/resources/x/accounts.mjs +4 -2
  59. package/resources/x/accounts.mjs.map +1 -1
  60. package/resources/x/communities/communities.d.mts +360 -10
  61. package/resources/x/communities/communities.d.mts.map +1 -1
  62. package/resources/x/communities/communities.d.ts +360 -10
  63. package/resources/x/communities/communities.d.ts.map +1 -1
  64. package/resources/x/communities/communities.js +17 -4
  65. package/resources/x/communities/communities.js.map +1 -1
  66. package/resources/x/communities/communities.mjs +17 -4
  67. package/resources/x/communities/communities.mjs.map +1 -1
  68. package/resources/x/communities/join.d.mts +361 -7
  69. package/resources/x/communities/join.d.mts.map +1 -1
  70. package/resources/x/communities/join.d.ts +361 -7
  71. package/resources/x/communities/join.d.ts.map +1 -1
  72. package/resources/x/communities/join.js +20 -5
  73. package/resources/x/communities/join.js.map +1 -1
  74. package/resources/x/communities/join.mjs +20 -5
  75. package/resources/x/communities/join.mjs.map +1 -1
  76. package/resources/x/dm.d.mts +183 -5
  77. package/resources/x/dm.d.mts.map +1 -1
  78. package/resources/x/dm.d.ts +183 -5
  79. package/resources/x/dm.d.ts.map +1 -1
  80. package/resources/x/dm.js +9 -2
  81. package/resources/x/dm.js.map +1 -1
  82. package/resources/x/dm.mjs +9 -2
  83. package/resources/x/dm.mjs.map +1 -1
  84. package/resources/x/media.d.mts +178 -10
  85. package/resources/x/media.d.mts.map +1 -1
  86. package/resources/x/media.d.ts +178 -10
  87. package/resources/x/media.d.ts.map +1 -1
  88. package/resources/x/media.js +9 -5
  89. package/resources/x/media.js.map +1 -1
  90. package/resources/x/media.mjs +9 -5
  91. package/resources/x/media.mjs.map +1 -1
  92. package/resources/x/profile.d.mts +545 -14
  93. package/resources/x/profile.d.mts.map +1 -1
  94. package/resources/x/profile.d.ts +545 -14
  95. package/resources/x/profile.d.ts.map +1 -1
  96. package/resources/x/profile.js +25 -6
  97. package/resources/x/profile.js.map +1 -1
  98. package/resources/x/profile.mjs +25 -6
  99. package/resources/x/profile.mjs.map +1 -1
  100. package/resources/x/tweets/like.d.mts +358 -6
  101. package/resources/x/tweets/like.d.mts.map +1 -1
  102. package/resources/x/tweets/like.d.ts +358 -6
  103. package/resources/x/tweets/like.d.ts.map +1 -1
  104. package/resources/x/tweets/like.js +17 -4
  105. package/resources/x/tweets/like.js.map +1 -1
  106. package/resources/x/tweets/like.mjs +17 -4
  107. package/resources/x/tweets/like.mjs.map +1 -1
  108. package/resources/x/tweets/retweet.d.mts +358 -6
  109. package/resources/x/tweets/retweet.d.mts.map +1 -1
  110. package/resources/x/tweets/retweet.d.ts +358 -6
  111. package/resources/x/tweets/retweet.d.ts.map +1 -1
  112. package/resources/x/tweets/retweet.js +17 -4
  113. package/resources/x/tweets/retweet.js.map +1 -1
  114. package/resources/x/tweets/retweet.mjs +17 -4
  115. package/resources/x/tweets/retweet.mjs.map +1 -1
  116. package/resources/x/tweets/tweets.d.mts +376 -18
  117. package/resources/x/tweets/tweets.d.mts.map +1 -1
  118. package/resources/x/tweets/tweets.d.ts +376 -18
  119. package/resources/x/tweets/tweets.d.ts.map +1 -1
  120. package/resources/x/tweets/tweets.js +25 -6
  121. package/resources/x/tweets/tweets.js.map +1 -1
  122. package/resources/x/tweets/tweets.mjs +25 -6
  123. package/resources/x/tweets/tweets.mjs.map +1 -1
  124. package/resources/x/users/follow.d.mts +361 -7
  125. package/resources/x/users/follow.d.mts.map +1 -1
  126. package/resources/x/users/follow.d.ts +361 -7
  127. package/resources/x/users/follow.d.ts.map +1 -1
  128. package/resources/x/users/follow.js +20 -5
  129. package/resources/x/users/follow.js.map +1 -1
  130. package/resources/x/users/follow.mjs +20 -5
  131. package/resources/x/users/follow.mjs.map +1 -1
  132. package/resources/x/users/users.d.mts +181 -5
  133. package/resources/x/users/users.d.mts.map +1 -1
  134. package/resources/x/users/users.d.ts +181 -5
  135. package/resources/x/users/users.d.ts.map +1 -1
  136. package/resources/x/users/users.js +9 -2
  137. package/resources/x/users/users.js.map +1 -1
  138. package/resources/x/users/users.mjs +9 -2
  139. package/resources/x/users/users.mjs.map +1 -1
  140. package/resources/x/write-actions.d.mts +155 -12
  141. package/resources/x/write-actions.d.mts.map +1 -1
  142. package/resources/x/write-actions.d.ts +155 -12
  143. package/resources/x/write-actions.d.ts.map +1 -1
  144. package/src/client.ts +1 -1
  145. package/src/resources/account.ts +2 -2
  146. package/src/resources/compose.ts +232 -65
  147. package/src/resources/credits.ts +1 -1
  148. package/src/resources/extractions.ts +4 -4
  149. package/src/resources/guest-wallets.ts +2 -2
  150. package/src/resources/monitors/keywords.ts +4 -4
  151. package/src/resources/monitors/monitors.ts +5 -4
  152. package/src/resources/shared.ts +93 -9
  153. package/src/resources/support/tickets.ts +122 -6
  154. package/src/resources/x/account-connection-challenges.ts +1 -1
  155. package/src/resources/x/accounts.ts +9 -6
  156. package/src/resources/x/communities/communities.ts +515 -12
  157. package/src/resources/x/communities/join.ts +518 -9
  158. package/src/resources/x/dm.ts +261 -6
  159. package/src/resources/x/media.ts +258 -11
  160. package/src/resources/x/profile.ts +786 -17
  161. package/src/resources/x/tweets/like.ts +515 -8
  162. package/src/resources/x/tweets/retweet.ts +523 -8
  163. package/src/resources/x/tweets/tweets.ts +529 -23
  164. package/src/resources/x/users/follow.ts +518 -9
  165. package/src/resources/x/users/users.ts +260 -6
  166. package/src/resources/x/write-actions.ts +207 -14
  167. package/src/version.ts +1 -1
  168. package/version.d.mts +1 -1
  169. package/version.d.ts +1 -1
  170. package/version.js +1 -1
  171. package/version.mjs +1 -1
@@ -13,6 +13,7 @@ import {
13
13
  import * as TweetsAPI from './tweets';
14
14
  import { TweetListByCommunityParams, TweetListParams, Tweets } from './tweets';
15
15
  import { APIPromise } from '../../../core/api-promise';
16
+ import { buildHeaders } from '../../../internal/headers';
16
17
  import { RequestOptions } from '../../../internal/request-options';
17
18
  import { path } from '../../../internal/utils/path';
18
19
 
@@ -28,12 +29,18 @@ export class Communities extends APIResource {
28
29
  * const community = await client.x.communities.create({
29
30
  * account: '@elonmusk',
30
31
  * name: 'Example Name',
32
+ * 'Idempotency-Key': 'Idempotency-Key',
31
33
  * description: 'A community for Tesla enthusiasts',
32
34
  * });
33
35
  * ```
34
36
  */
35
- create(body: CommunityCreateParams, options?: RequestOptions): APIPromise<CommunityCreateResponse> {
36
- return this._client.post('/x/communities', { body, ...options });
37
+ create(params: CommunityCreateParams, options?: RequestOptions): APIPromise<CommunityCreateResponse> {
38
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
39
+ return this._client.post('/x/communities', {
40
+ body,
41
+ ...options,
42
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
43
+ });
37
44
  }
38
45
 
39
46
  /**
@@ -44,15 +51,21 @@ export class Communities extends APIResource {
44
51
  * const community = await client.x.communities.delete('id', {
45
52
  * account: '@elonmusk',
46
53
  * community_name: 'Tesla Fans',
54
+ * 'Idempotency-Key': 'Idempotency-Key',
47
55
  * });
48
56
  * ```
49
57
  */
50
58
  delete(
51
59
  id: string,
52
- body: CommunityDeleteParams,
60
+ params: CommunityDeleteParams,
53
61
  options?: RequestOptions,
54
62
  ): APIPromise<CommunityDeleteResponse> {
55
- return this._client.delete(path`/x/communities/${id}`, { body, ...options });
63
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
64
+ return this._client.delete(path`/x/communities/${id}`, {
65
+ body,
66
+ ...options,
67
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
68
+ });
56
69
  }
57
70
 
58
71
  /**
@@ -123,16 +136,490 @@ export class Communities extends APIResource {
123
136
  }
124
137
  }
125
138
 
139
+ /**
140
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
141
+ * the original Idempotency-Key returns this same record. Submit a new write only
142
+ * when safeToRetry is true, using a new key.
143
+ */
126
144
  export interface CommunityCreateResponse {
127
- communityId: string;
145
+ id: string;
146
+
147
+ /**
148
+ * Connected account selected for the write.
149
+ */
150
+ account: CommunityCreateResponse.Account | null;
151
+
152
+ action:
153
+ | 'create_tweet'
154
+ | 'delete_tweet'
155
+ | 'like'
156
+ | 'unlike'
157
+ | 'retweet'
158
+ | 'unretweet'
159
+ | 'follow'
160
+ | 'unfollow'
161
+ | 'remove_follower'
162
+ | 'send_dm'
163
+ | 'upload_media'
164
+ | 'update_profile'
165
+ | 'update_avatar'
166
+ | 'update_banner'
167
+ | 'create_community'
168
+ | 'delete_community'
169
+ | 'join_community'
170
+ | 'leave_community';
171
+
172
+ /**
173
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
174
+ * credit ledger. Pending or failed writes are not charged.
175
+ */
176
+ billing: CommunityCreateResponse.Billing;
177
+
178
+ charged: boolean;
179
+
180
+ chargedCredits: string;
181
+
182
+ /**
183
+ * Exact follow-up an API client or agent should perform.
184
+ */
185
+ nextAction: CommunityCreateResponse.NextAction | null;
186
+
187
+ object: 'x_write_action';
188
+
189
+ pollAfterMs: number | null;
190
+
191
+ /**
192
+ * Stable fingerprint and sanitized payload for replay checks.
193
+ */
194
+ request: CommunityCreateResponse.Request;
195
+
196
+ /**
197
+ * Confirmed result produced by the write, when available.
198
+ */
199
+ result: CommunityCreateResponse.Result | null;
200
+
201
+ /**
202
+ * True only when a new attempt can reasonably succeed.
203
+ */
204
+ retryable: boolean;
205
+
206
+ /**
207
+ * True only when no write was dispatched and a new idempotency key may be used.
208
+ */
209
+ safeToRetry: boolean;
210
+
211
+ sendDispatched: boolean;
212
+
213
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
214
+
215
+ statusUrl: string;
216
+
217
+ success: boolean;
218
+
219
+ /**
220
+ * Existing X resource targeted by the write, when applicable.
221
+ */
222
+ target: CommunityCreateResponse.Target | null;
223
+
224
+ targetId: string | null;
225
+
226
+ terminal: boolean;
128
227
 
129
- success: true;
228
+ writeActionId: string;
130
229
 
230
+ /**
231
+ * Compatibility field for a confirmed community ID.
232
+ */
233
+ communityId?: string;
234
+
235
+ /**
236
+ * Confirmed community name when available.
237
+ */
131
238
  communityName?: string;
239
+
240
+ completedAt?: string;
241
+
242
+ confirmationAttempts?: number;
243
+
244
+ confirmationCheckedAt?: string;
245
+
246
+ confirmedAt?: string;
247
+
248
+ createdAt?: string;
249
+
250
+ /**
251
+ * Structured recovery context for a failed write.
252
+ */
253
+ details?: { [key: string]: unknown };
254
+
255
+ error?: string;
256
+
257
+ /**
258
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
259
+ * retention deadline.
260
+ */
261
+ expiresAt?: string;
262
+
263
+ idempotent?: boolean;
264
+
265
+ /**
266
+ * Media count, kind, size, and billing details when used.
267
+ */
268
+ media?: { [key: string]: unknown };
269
+
270
+ /**
271
+ * Compatibility field for a confirmed media upload ID.
272
+ */
273
+ mediaId?: string;
274
+
275
+ /**
276
+ * Public media URL when the upload creates one.
277
+ */
278
+ mediaUrl?: string;
279
+
280
+ message?: string;
281
+
282
+ /**
283
+ * Compatibility field for a confirmed direct message ID.
284
+ */
285
+ messageId?: string;
286
+
287
+ requestHash?: string;
288
+
289
+ requestId?: string;
290
+
291
+ /**
292
+ * Compatibility result ID for other write actions.
293
+ */
294
+ resultId?: string;
295
+
296
+ /**
297
+ * Dispatch timestamp when the write reached execution.
298
+ */
299
+ sendDispatchedAt?: string;
300
+
301
+ /**
302
+ * Compatibility field for a confirmed tweet result ID.
303
+ */
304
+ tweetId?: string;
305
+
306
+ updatedAt?: string;
307
+ }
308
+
309
+ export namespace CommunityCreateResponse {
310
+ /**
311
+ * Connected account selected for the write.
312
+ */
313
+ export interface Account {
314
+ id: string;
315
+
316
+ username: string;
317
+ }
318
+
319
+ /**
320
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
321
+ * credit ledger. Pending or failed writes are not charged.
322
+ */
323
+ export interface Billing {
324
+ charged: boolean;
325
+
326
+ chargedCredits: string;
327
+
328
+ plannedCredits: string;
329
+
330
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
331
+ }
332
+
333
+ /**
334
+ * Exact follow-up an API client or agent should perform.
335
+ */
336
+ export interface NextAction {
337
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
338
+
339
+ afterMs?: number;
340
+
341
+ requiresNewIdempotencyKey?: boolean;
342
+
343
+ url?: string;
344
+ }
345
+
346
+ /**
347
+ * Stable fingerprint and sanitized payload for replay checks.
348
+ */
349
+ export interface Request {
350
+ /**
351
+ * Stable hash of account, action, target, and payload.
352
+ */
353
+ hash: string | null;
354
+
355
+ /**
356
+ * Exact sanitized payload dispatched for this action.
357
+ */
358
+ payload: { [key: string]: unknown } | null;
359
+ }
360
+
361
+ /**
362
+ * Confirmed result produced by the write, when available.
363
+ */
364
+ export interface Result {
365
+ id?: string;
366
+
367
+ state?: string;
368
+
369
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
370
+ }
371
+
372
+ /**
373
+ * Existing X resource targeted by the write, when applicable.
374
+ */
375
+ export interface Target {
376
+ id: string;
377
+
378
+ type: 'tweet' | 'user' | 'community';
379
+ }
132
380
  }
133
381
 
382
+ /**
383
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
384
+ * the original Idempotency-Key returns this same record. Submit a new write only
385
+ * when safeToRetry is true, using a new key.
386
+ */
134
387
  export interface CommunityDeleteResponse {
135
- success: true;
388
+ id: string;
389
+
390
+ /**
391
+ * Connected account selected for the write.
392
+ */
393
+ account: CommunityDeleteResponse.Account | null;
394
+
395
+ action:
396
+ | 'create_tweet'
397
+ | 'delete_tweet'
398
+ | 'like'
399
+ | 'unlike'
400
+ | 'retweet'
401
+ | 'unretweet'
402
+ | 'follow'
403
+ | 'unfollow'
404
+ | 'remove_follower'
405
+ | 'send_dm'
406
+ | 'upload_media'
407
+ | 'update_profile'
408
+ | 'update_avatar'
409
+ | 'update_banner'
410
+ | 'create_community'
411
+ | 'delete_community'
412
+ | 'join_community'
413
+ | 'leave_community';
414
+
415
+ /**
416
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
417
+ * credit ledger. Pending or failed writes are not charged.
418
+ */
419
+ billing: CommunityDeleteResponse.Billing;
420
+
421
+ charged: boolean;
422
+
423
+ chargedCredits: string;
424
+
425
+ /**
426
+ * Exact follow-up an API client or agent should perform.
427
+ */
428
+ nextAction: CommunityDeleteResponse.NextAction | null;
429
+
430
+ object: 'x_write_action';
431
+
432
+ pollAfterMs: number | null;
433
+
434
+ /**
435
+ * Stable fingerprint and sanitized payload for replay checks.
436
+ */
437
+ request: CommunityDeleteResponse.Request;
438
+
439
+ /**
440
+ * Confirmed result produced by the write, when available.
441
+ */
442
+ result: CommunityDeleteResponse.Result | null;
443
+
444
+ /**
445
+ * True only when a new attempt can reasonably succeed.
446
+ */
447
+ retryable: boolean;
448
+
449
+ /**
450
+ * True only when no write was dispatched and a new idempotency key may be used.
451
+ */
452
+ safeToRetry: boolean;
453
+
454
+ sendDispatched: boolean;
455
+
456
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
457
+
458
+ statusUrl: string;
459
+
460
+ success: boolean;
461
+
462
+ /**
463
+ * Existing X resource targeted by the write, when applicable.
464
+ */
465
+ target: CommunityDeleteResponse.Target | null;
466
+
467
+ targetId: string | null;
468
+
469
+ terminal: boolean;
470
+
471
+ writeActionId: string;
472
+
473
+ /**
474
+ * Compatibility field for a confirmed community ID.
475
+ */
476
+ communityId?: string;
477
+
478
+ /**
479
+ * Confirmed community name when available.
480
+ */
481
+ communityName?: string;
482
+
483
+ completedAt?: string;
484
+
485
+ confirmationAttempts?: number;
486
+
487
+ confirmationCheckedAt?: string;
488
+
489
+ confirmedAt?: string;
490
+
491
+ createdAt?: string;
492
+
493
+ /**
494
+ * Structured recovery context for a failed write.
495
+ */
496
+ details?: { [key: string]: unknown };
497
+
498
+ error?: string;
499
+
500
+ /**
501
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
502
+ * retention deadline.
503
+ */
504
+ expiresAt?: string;
505
+
506
+ idempotent?: boolean;
507
+
508
+ /**
509
+ * Media count, kind, size, and billing details when used.
510
+ */
511
+ media?: { [key: string]: unknown };
512
+
513
+ /**
514
+ * Compatibility field for a confirmed media upload ID.
515
+ */
516
+ mediaId?: string;
517
+
518
+ /**
519
+ * Public media URL when the upload creates one.
520
+ */
521
+ mediaUrl?: string;
522
+
523
+ message?: string;
524
+
525
+ /**
526
+ * Compatibility field for a confirmed direct message ID.
527
+ */
528
+ messageId?: string;
529
+
530
+ requestHash?: string;
531
+
532
+ requestId?: string;
533
+
534
+ /**
535
+ * Compatibility result ID for other write actions.
536
+ */
537
+ resultId?: string;
538
+
539
+ /**
540
+ * Dispatch timestamp when the write reached execution.
541
+ */
542
+ sendDispatchedAt?: string;
543
+
544
+ /**
545
+ * Compatibility field for a confirmed tweet result ID.
546
+ */
547
+ tweetId?: string;
548
+
549
+ updatedAt?: string;
550
+ }
551
+
552
+ export namespace CommunityDeleteResponse {
553
+ /**
554
+ * Connected account selected for the write.
555
+ */
556
+ export interface Account {
557
+ id: string;
558
+
559
+ username: string;
560
+ }
561
+
562
+ /**
563
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
564
+ * credit ledger. Pending or failed writes are not charged.
565
+ */
566
+ export interface Billing {
567
+ charged: boolean;
568
+
569
+ chargedCredits: string;
570
+
571
+ plannedCredits: string;
572
+
573
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
574
+ }
575
+
576
+ /**
577
+ * Exact follow-up an API client or agent should perform.
578
+ */
579
+ export interface NextAction {
580
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
581
+
582
+ afterMs?: number;
583
+
584
+ requiresNewIdempotencyKey?: boolean;
585
+
586
+ url?: string;
587
+ }
588
+
589
+ /**
590
+ * Stable fingerprint and sanitized payload for replay checks.
591
+ */
592
+ export interface Request {
593
+ /**
594
+ * Stable hash of account, action, target, and payload.
595
+ */
596
+ hash: string | null;
597
+
598
+ /**
599
+ * Exact sanitized payload dispatched for this action.
600
+ */
601
+ payload: { [key: string]: unknown } | null;
602
+ }
603
+
604
+ /**
605
+ * Confirmed result produced by the write, when available.
606
+ */
607
+ export interface Result {
608
+ id?: string;
609
+
610
+ state?: string;
611
+
612
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
613
+ }
614
+
615
+ /**
616
+ * Existing X resource targeted by the write, when applicable.
617
+ */
618
+ export interface Target {
619
+ id: string;
620
+
621
+ type: 'tweet' | 'user' | 'community';
622
+ }
136
623
  }
137
624
 
138
625
  export interface CommunityRetrieveInfoResponse {
@@ -252,31 +739,47 @@ export namespace CommunityRetrieveInfoResponse {
252
739
 
253
740
  export interface CommunityCreateParams {
254
741
  /**
255
- * X account (@username or ID) creating the community
742
+ * Body param: X account (@username or ID) creating the community
256
743
  */
257
744
  account: string;
258
745
 
259
746
  /**
260
- * Community name
747
+ * Body param: Community name
261
748
  */
262
749
  name: string;
263
750
 
264
751
  /**
265
- * Community description
752
+ * Header param: Generate one unique value for each intended write. Reuse it only
753
+ * when retrying the exact same account, action, target, and payload. A reused key
754
+ * returns the original action. Reusing it with different input returns 409. Replay
755
+ * protection remains active for at least 90 days.
756
+ */
757
+ 'Idempotency-Key': string;
758
+
759
+ /**
760
+ * Body param: Community description
266
761
  */
267
762
  description?: string;
268
763
  }
269
764
 
270
765
  export interface CommunityDeleteParams {
271
766
  /**
272
- * X account (@username or ID) deleting the community
767
+ * Body param: X account (@username or ID) deleting the community
273
768
  */
274
769
  account: string;
275
770
 
276
771
  /**
277
- * Community name for confirmation
772
+ * Body param: Community name for confirmation
278
773
  */
279
774
  community_name: string;
775
+
776
+ /**
777
+ * Header param: Generate one unique value for each intended write. Reuse it only
778
+ * when retrying the exact same account, action, target, and payload. A reused key
779
+ * returns the original action. Reusing it with different input returns 409. Replay
780
+ * protection remains active for at least 90 days.
781
+ */
782
+ 'Idempotency-Key': string;
280
783
  }
281
784
 
282
785
  export interface CommunityRetrieveMembersParams {