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
  RetweetDeleteResponse,
14
14
  } from './retweet';
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
 
@@ -27,12 +28,18 @@ export class Tweets extends APIResource {
27
28
  * ```ts
28
29
  * const tweet = await client.x.tweets.create({
29
30
  * account: '@elonmusk',
31
+ * 'Idempotency-Key': 'Idempotency-Key',
30
32
  * text: 'Just launched our new feature!',
31
33
  * });
32
34
  * ```
33
35
  */
34
- create(body: TweetCreateParams, options?: RequestOptions): APIPromise<TweetCreateResponse> {
35
- return this._client.post('/x/tweets', { body, ...options });
36
+ create(params: TweetCreateParams, options?: RequestOptions): APIPromise<TweetCreateResponse> {
37
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
38
+ return this._client.post('/x/tweets', {
39
+ body,
40
+ ...options,
41
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
42
+ });
36
43
  }
37
44
 
38
45
  /**
@@ -68,15 +75,23 @@ export class Tweets extends APIResource {
68
75
  * ```ts
69
76
  * const tweet = await client.x.tweets.delete('id', {
70
77
  * account: '@elonmusk',
78
+ * 'Idempotency-Key': 'Idempotency-Key',
71
79
  * });
72
80
  * ```
73
81
  */
74
- delete(id: string, body: TweetDeleteParams, options?: RequestOptions): APIPromise<TweetDeleteResponse> {
75
- return this._client.delete(path`/x/tweets/${id}`, { body, ...options });
82
+ delete(id: string, params: TweetDeleteParams, options?: RequestOptions): APIPromise<TweetDeleteResponse> {
83
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
84
+ return this._client.delete(path`/x/tweets/${id}`, {
85
+ body,
86
+ ...options,
87
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
88
+ });
76
89
  }
77
90
 
78
91
  /**
79
- * List users who liked a tweet
92
+ * Returns liker profiles that X makes visible for the post. X can withhold liker
93
+ * identities even when the post reports likes. In that case this endpoint returns
94
+ * 424 `favoriters_unavailable` instead of a misleading empty success.
80
95
  *
81
96
  * @example
82
97
  * ```ts
@@ -112,7 +127,11 @@ export class Tweets extends APIResource {
112
127
  }
113
128
 
114
129
  /**
115
- * List replies to a tweet
130
+ * Returns visible replies. For an unfiltered first page, Xquik compares a terminal
131
+ * page with the post's reported reply count. If the page is visibly incomplete,
132
+ * the endpoint returns 424 `replies_incomplete` instead of presenting partial
133
+ * coverage as complete. Use tweet search with a `conversation_id:{id}` query as
134
+ * the broader fallback.
116
135
  *
117
136
  * @example
118
137
  * ```ts
@@ -184,11 +203,7 @@ export class Tweets extends APIResource {
184
203
  * Tweet author profile. The lookup route always includes follower count and
185
204
  * verification state. Other profile fields appear when available.
186
205
  */
187
- export interface TweetAuthor extends Shared.UserProfile {
188
- followers: number;
189
-
190
- verified: boolean;
191
- }
206
+ export interface TweetAuthor extends Shared.UserProfile {}
192
207
 
193
208
  /**
194
209
  * Full tweet with text, engagement metrics, media, and metadata. A zero metric can
@@ -315,19 +330,247 @@ export interface TweetDetail {
315
330
  url?: string;
316
331
  }
317
332
 
333
+ /**
334
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
335
+ * the original Idempotency-Key returns this same record. Submit a new write only
336
+ * when safeToRetry is true, using a new key.
337
+ */
318
338
  export interface TweetCreateResponse {
319
- charged: boolean;
339
+ id: string;
340
+
341
+ /**
342
+ * Connected account selected for the write.
343
+ */
344
+ account: TweetCreateResponse.Account | null;
345
+
346
+ action:
347
+ | 'create_tweet'
348
+ | 'delete_tweet'
349
+ | 'like'
350
+ | 'unlike'
351
+ | 'retweet'
352
+ | 'unretweet'
353
+ | 'follow'
354
+ | 'unfollow'
355
+ | 'remove_follower'
356
+ | 'send_dm'
357
+ | 'upload_media'
358
+ | 'update_profile'
359
+ | 'update_avatar'
360
+ | 'update_banner'
361
+ | 'create_community'
362
+ | 'delete_community'
363
+ | 'join_community'
364
+ | 'leave_community';
320
365
 
321
366
  /**
322
- * Usage charged for this tweet.
367
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
368
+ * credit ledger. Pending or failed writes are not charged.
323
369
  */
370
+ billing: TweetCreateResponse.Billing;
371
+
372
+ charged: boolean;
373
+
324
374
  chargedCredits: string;
325
375
 
326
- success: true;
376
+ /**
377
+ * Exact follow-up an API client or agent should perform.
378
+ */
379
+ nextAction: TweetCreateResponse.NextAction | null;
380
+
381
+ object: 'x_write_action';
382
+
383
+ pollAfterMs: number | null;
384
+
385
+ /**
386
+ * Stable fingerprint and sanitized payload for replay checks.
387
+ */
388
+ request: TweetCreateResponse.Request;
389
+
390
+ /**
391
+ * Confirmed result produced by the write, when available.
392
+ */
393
+ result: TweetCreateResponse.Result | null;
394
+
395
+ /**
396
+ * True only when a new attempt can reasonably succeed.
397
+ */
398
+ retryable: boolean;
399
+
400
+ /**
401
+ * True only when no write was dispatched and a new idempotency key may be used.
402
+ */
403
+ safeToRetry: boolean;
404
+
405
+ sendDispatched: boolean;
406
+
407
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
408
+
409
+ statusUrl: string;
410
+
411
+ success: boolean;
412
+
413
+ /**
414
+ * Existing X resource targeted by the write, when applicable.
415
+ */
416
+ target: TweetCreateResponse.Target | null;
417
+
418
+ targetId: string | null;
419
+
420
+ terminal: boolean;
421
+
422
+ writeActionId: string;
423
+
424
+ /**
425
+ * Compatibility field for a confirmed community ID.
426
+ */
427
+ communityId?: string;
428
+
429
+ /**
430
+ * Confirmed community name when available.
431
+ */
432
+ communityName?: string;
433
+
434
+ completedAt?: string;
435
+
436
+ confirmationAttempts?: number;
437
+
438
+ confirmationCheckedAt?: string;
439
+
440
+ confirmedAt?: string;
441
+
442
+ createdAt?: string;
443
+
444
+ /**
445
+ * Structured recovery context for a failed write.
446
+ */
447
+ details?: { [key: string]: unknown };
448
+
449
+ error?: string;
450
+
451
+ /**
452
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
453
+ * retention deadline.
454
+ */
455
+ expiresAt?: string;
456
+
457
+ idempotent?: boolean;
458
+
459
+ /**
460
+ * Media count, kind, size, and billing details when used.
461
+ */
462
+ media?: { [key: string]: unknown };
463
+
464
+ /**
465
+ * Compatibility field for a confirmed media upload ID.
466
+ */
467
+ mediaId?: string;
468
+
469
+ /**
470
+ * Public media URL when the upload creates one.
471
+ */
472
+ mediaUrl?: string;
473
+
474
+ message?: string;
475
+
476
+ /**
477
+ * Compatibility field for a confirmed direct message ID.
478
+ */
479
+ messageId?: string;
480
+
481
+ requestHash?: string;
482
+
483
+ requestId?: string;
484
+
485
+ /**
486
+ * Compatibility result ID for other write actions.
487
+ */
488
+ resultId?: string;
489
+
490
+ /**
491
+ * Dispatch timestamp when the write reached execution.
492
+ */
493
+ sendDispatchedAt?: string;
327
494
 
328
- tweetId: string;
495
+ /**
496
+ * Compatibility field for a confirmed tweet result ID.
497
+ */
498
+ tweetId?: string;
329
499
 
330
- writeActionId?: string;
500
+ updatedAt?: string;
501
+ }
502
+
503
+ export namespace TweetCreateResponse {
504
+ /**
505
+ * Connected account selected for the write.
506
+ */
507
+ export interface Account {
508
+ id: string;
509
+
510
+ username: string;
511
+ }
512
+
513
+ /**
514
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
515
+ * credit ledger. Pending or failed writes are not charged.
516
+ */
517
+ export interface Billing {
518
+ charged: boolean;
519
+
520
+ chargedCredits: string;
521
+
522
+ plannedCredits: string;
523
+
524
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
525
+ }
526
+
527
+ /**
528
+ * Exact follow-up an API client or agent should perform.
529
+ */
530
+ export interface NextAction {
531
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
532
+
533
+ afterMs?: number;
534
+
535
+ requiresNewIdempotencyKey?: boolean;
536
+
537
+ url?: string;
538
+ }
539
+
540
+ /**
541
+ * Stable fingerprint and sanitized payload for replay checks.
542
+ */
543
+ export interface Request {
544
+ /**
545
+ * Stable hash of account, action, target, and payload.
546
+ */
547
+ hash: string | null;
548
+
549
+ /**
550
+ * Exact sanitized payload dispatched for this action.
551
+ */
552
+ payload: { [key: string]: unknown } | null;
553
+ }
554
+
555
+ /**
556
+ * Confirmed result produced by the write, when available.
557
+ */
558
+ export interface Result {
559
+ id?: string;
560
+
561
+ state?: string;
562
+
563
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
564
+ }
565
+
566
+ /**
567
+ * Existing X resource targeted by the write, when applicable.
568
+ */
569
+ export interface Target {
570
+ id: string;
571
+
572
+ type: 'tweet' | 'user' | 'community';
573
+ }
331
574
  }
332
575
 
333
576
  export interface TweetRetrieveResponse {
@@ -344,32 +587,287 @@ export interface TweetRetrieveResponse {
344
587
  author?: TweetAuthor;
345
588
  }
346
589
 
590
+ /**
591
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
592
+ * the original Idempotency-Key returns this same record. Submit a new write only
593
+ * when safeToRetry is true, using a new key.
594
+ */
347
595
  export interface TweetDeleteResponse {
348
- success: true;
596
+ id: string;
597
+
598
+ /**
599
+ * Connected account selected for the write.
600
+ */
601
+ account: TweetDeleteResponse.Account | null;
602
+
603
+ action:
604
+ | 'create_tweet'
605
+ | 'delete_tweet'
606
+ | 'like'
607
+ | 'unlike'
608
+ | 'retweet'
609
+ | 'unretweet'
610
+ | 'follow'
611
+ | 'unfollow'
612
+ | 'remove_follower'
613
+ | 'send_dm'
614
+ | 'upload_media'
615
+ | 'update_profile'
616
+ | 'update_avatar'
617
+ | 'update_banner'
618
+ | 'create_community'
619
+ | 'delete_community'
620
+ | 'join_community'
621
+ | 'leave_community';
622
+
623
+ /**
624
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
625
+ * credit ledger. Pending or failed writes are not charged.
626
+ */
627
+ billing: TweetDeleteResponse.Billing;
628
+
629
+ charged: boolean;
630
+
631
+ chargedCredits: string;
632
+
633
+ /**
634
+ * Exact follow-up an API client or agent should perform.
635
+ */
636
+ nextAction: TweetDeleteResponse.NextAction | null;
637
+
638
+ object: 'x_write_action';
639
+
640
+ pollAfterMs: number | null;
641
+
642
+ /**
643
+ * Stable fingerprint and sanitized payload for replay checks.
644
+ */
645
+ request: TweetDeleteResponse.Request;
646
+
647
+ /**
648
+ * Confirmed result produced by the write, when available.
649
+ */
650
+ result: TweetDeleteResponse.Result | null;
651
+
652
+ /**
653
+ * True only when a new attempt can reasonably succeed.
654
+ */
655
+ retryable: boolean;
656
+
657
+ /**
658
+ * True only when no write was dispatched and a new idempotency key may be used.
659
+ */
660
+ safeToRetry: boolean;
661
+
662
+ sendDispatched: boolean;
663
+
664
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
665
+
666
+ statusUrl: string;
667
+
668
+ success: boolean;
669
+
670
+ /**
671
+ * Existing X resource targeted by the write, when applicable.
672
+ */
673
+ target: TweetDeleteResponse.Target | null;
674
+
675
+ targetId: string | null;
676
+
677
+ terminal: boolean;
678
+
679
+ writeActionId: string;
680
+
681
+ /**
682
+ * Compatibility field for a confirmed community ID.
683
+ */
684
+ communityId?: string;
685
+
686
+ /**
687
+ * Confirmed community name when available.
688
+ */
689
+ communityName?: string;
690
+
691
+ completedAt?: string;
692
+
693
+ confirmationAttempts?: number;
694
+
695
+ confirmationCheckedAt?: string;
696
+
697
+ confirmedAt?: string;
698
+
699
+ createdAt?: string;
700
+
701
+ /**
702
+ * Structured recovery context for a failed write.
703
+ */
704
+ details?: { [key: string]: unknown };
705
+
706
+ error?: string;
707
+
708
+ /**
709
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
710
+ * retention deadline.
711
+ */
712
+ expiresAt?: string;
713
+
714
+ idempotent?: boolean;
715
+
716
+ /**
717
+ * Media count, kind, size, and billing details when used.
718
+ */
719
+ media?: { [key: string]: unknown };
720
+
721
+ /**
722
+ * Compatibility field for a confirmed media upload ID.
723
+ */
724
+ mediaId?: string;
725
+
726
+ /**
727
+ * Public media URL when the upload creates one.
728
+ */
729
+ mediaUrl?: string;
730
+
731
+ message?: string;
732
+
733
+ /**
734
+ * Compatibility field for a confirmed direct message ID.
735
+ */
736
+ messageId?: string;
737
+
738
+ requestHash?: string;
739
+
740
+ requestId?: string;
741
+
742
+ /**
743
+ * Compatibility result ID for other write actions.
744
+ */
745
+ resultId?: string;
746
+
747
+ /**
748
+ * Dispatch timestamp when the write reached execution.
749
+ */
750
+ sendDispatchedAt?: string;
751
+
752
+ /**
753
+ * Compatibility field for a confirmed tweet result ID.
754
+ */
755
+ tweetId?: string;
756
+
757
+ updatedAt?: string;
758
+ }
759
+
760
+ export namespace TweetDeleteResponse {
761
+ /**
762
+ * Connected account selected for the write.
763
+ */
764
+ export interface Account {
765
+ id: string;
766
+
767
+ username: string;
768
+ }
769
+
770
+ /**
771
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
772
+ * credit ledger. Pending or failed writes are not charged.
773
+ */
774
+ export interface Billing {
775
+ charged: boolean;
776
+
777
+ chargedCredits: string;
778
+
779
+ plannedCredits: string;
780
+
781
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
782
+ }
783
+
784
+ /**
785
+ * Exact follow-up an API client or agent should perform.
786
+ */
787
+ export interface NextAction {
788
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
789
+
790
+ afterMs?: number;
791
+
792
+ requiresNewIdempotencyKey?: boolean;
793
+
794
+ url?: string;
795
+ }
796
+
797
+ /**
798
+ * Stable fingerprint and sanitized payload for replay checks.
799
+ */
800
+ export interface Request {
801
+ /**
802
+ * Stable hash of account, action, target, and payload.
803
+ */
804
+ hash: string | null;
805
+
806
+ /**
807
+ * Exact sanitized payload dispatched for this action.
808
+ */
809
+ payload: { [key: string]: unknown } | null;
810
+ }
811
+
812
+ /**
813
+ * Confirmed result produced by the write, when available.
814
+ */
815
+ export interface Result {
816
+ id?: string;
817
+
818
+ state?: string;
819
+
820
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
821
+ }
822
+
823
+ /**
824
+ * Existing X resource targeted by the write, when applicable.
825
+ */
826
+ export interface Target {
827
+ id: string;
828
+
829
+ type: 'tweet' | 'user' | 'community';
830
+ }
349
831
  }
350
832
 
351
833
  export interface TweetCreateParams {
352
834
  /**
353
- * X account (@username or account ID)
835
+ * Body param: X account (@username or account ID)
354
836
  */
355
837
  account: string;
356
838
 
357
- attachment_url?: string;
839
+ /**
840
+ * Header param: Generate one unique value for each intended write. Reuse it only
841
+ * when retrying the exact same account, action, target, and payload. A reused key
842
+ * returns the original action. Reusing it with different input returns 409. Replay
843
+ * protection remains active for at least 90 days.
844
+ */
845
+ 'Idempotency-Key': string;
358
846
 
847
+ /**
848
+ * Body param
849
+ */
359
850
  community_id?: string;
360
851
 
852
+ /**
853
+ * Body param
854
+ */
361
855
  is_note_tweet?: boolean;
362
856
 
363
857
  /**
364
- * Array of public media URLs to attach. Supports up to 4 images or exactly 1 MP4
365
- * video up to 100 MB. Each URL must be publicly reachable.
858
+ * Body param: Array of public media URLs to attach. Supports up to 4 images or
859
+ * exactly 1 MP4 video up to 100 MB. Each URL must be publicly reachable. Attached
860
+ * media adds 2 credits per started MB across all files.
366
861
  */
367
862
  media?: Array<string>;
368
863
 
864
+ /**
865
+ * Body param
866
+ */
369
867
  reply_to_tweet_id?: string;
370
868
 
371
869
  /**
372
- * Tweet text (optional when media is provided)
870
+ * Body param: Tweet text (optional when media is provided)
373
871
  */
374
872
  text?: string;
375
873
  }
@@ -383,9 +881,17 @@ export interface TweetListParams {
383
881
 
384
882
  export interface TweetDeleteParams {
385
883
  /**
386
- * X account identifier (@username or account ID)
884
+ * Body param: X account identifier (@username or account ID)
387
885
  */
388
886
  account: string;
887
+
888
+ /**
889
+ * Header param: Generate one unique value for each intended write. Reuse it only
890
+ * when retrying the exact same account, action, target, and payload. A reused key
891
+ * returns the original action. Reusing it with different input returns 409. Replay
892
+ * protection remains active for at least 90 days.
893
+ */
894
+ 'Idempotency-Key': string;
389
895
  }
390
896
 
391
897
  export interface TweetGetFavoritersParams {