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
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import { APIPromise } from '../../core/api-promise';
5
+ import { buildHeaders } from '../../internal/headers';
5
6
  import { RequestOptions } from '../../internal/request-options';
6
7
  import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
7
8
 
@@ -16,6 +17,7 @@ export class Profile extends APIResource {
16
17
  * ```ts
17
18
  * const profile = await client.x.profile.update({
18
19
  * account: '@elonmusk',
20
+ * 'Idempotency-Key': 'Idempotency-Key',
19
21
  * description: 'description_value',
20
22
  * location: 'location_value',
21
23
  * name: 'Example Name',
@@ -23,8 +25,13 @@ export class Profile extends APIResource {
23
25
  * });
24
26
  * ```
25
27
  */
26
- update(body: ProfileUpdateParams, options?: RequestOptions): APIPromise<ProfileUpdateResponse> {
27
- return this._client.patch('/x/profile', { body, ...options });
28
+ update(params: ProfileUpdateParams, options?: RequestOptions): APIPromise<ProfileUpdateResponse> {
29
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
30
+ return this._client.patch('/x/profile', {
31
+ body,
32
+ ...options,
33
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
34
+ });
28
35
  }
29
36
 
30
37
  /**
@@ -35,16 +42,25 @@ export class Profile extends APIResource {
35
42
  * const response = await client.x.profile.updateAvatar({
36
43
  * account: '@elonmusk',
37
44
  * url: 'https://example.com/avatar.png',
45
+ * 'Idempotency-Key': 'Idempotency-Key',
38
46
  * });
39
47
  * ```
40
48
  */
41
49
  updateAvatar(
42
- body: ProfileUpdateAvatarParams,
50
+ params: ProfileUpdateAvatarParams,
43
51
  options?: RequestOptions,
44
52
  ): APIPromise<ProfileUpdateAvatarResponse> {
53
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
45
54
  return this._client.patch(
46
55
  '/x/profile/avatar',
47
- maybeMultipartFormRequestOptions({ body, ...options }, this._client),
56
+ maybeMultipartFormRequestOptions(
57
+ {
58
+ body,
59
+ ...options,
60
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
61
+ },
62
+ this._client,
63
+ ),
48
64
  );
49
65
  }
50
66
 
@@ -56,78 +72,831 @@ export class Profile extends APIResource {
56
72
  * const response = await client.x.profile.updateBanner({
57
73
  * account: '@elonmusk',
58
74
  * url: 'https://example.com/banner.png',
75
+ * 'Idempotency-Key': 'Idempotency-Key',
59
76
  * });
60
77
  * ```
61
78
  */
62
79
  updateBanner(
63
- body: ProfileUpdateBannerParams,
80
+ params: ProfileUpdateBannerParams,
64
81
  options?: RequestOptions,
65
82
  ): APIPromise<ProfileUpdateBannerResponse> {
83
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
66
84
  return this._client.patch(
67
85
  '/x/profile/banner',
68
- maybeMultipartFormRequestOptions({ body, ...options }, this._client),
86
+ maybeMultipartFormRequestOptions(
87
+ {
88
+ body,
89
+ ...options,
90
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
91
+ },
92
+ this._client,
93
+ ),
69
94
  );
70
95
  }
71
96
  }
72
97
 
98
+ /**
99
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
100
+ * the original Idempotency-Key returns this same record. Submit a new write only
101
+ * when safeToRetry is true, using a new key.
102
+ */
73
103
  export interface ProfileUpdateResponse {
74
- success: true;
104
+ id: string;
105
+
106
+ /**
107
+ * Connected account selected for the write.
108
+ */
109
+ account: ProfileUpdateResponse.Account | null;
110
+
111
+ action:
112
+ | 'create_tweet'
113
+ | 'delete_tweet'
114
+ | 'like'
115
+ | 'unlike'
116
+ | 'retweet'
117
+ | 'unretweet'
118
+ | 'follow'
119
+ | 'unfollow'
120
+ | 'remove_follower'
121
+ | 'send_dm'
122
+ | 'upload_media'
123
+ | 'update_profile'
124
+ | 'update_avatar'
125
+ | 'update_banner'
126
+ | 'create_community'
127
+ | 'delete_community'
128
+ | 'join_community'
129
+ | 'leave_community';
130
+
131
+ /**
132
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
133
+ * credit ledger. Pending or failed writes are not charged.
134
+ */
135
+ billing: ProfileUpdateResponse.Billing;
136
+
137
+ charged: boolean;
138
+
139
+ chargedCredits: string;
140
+
141
+ /**
142
+ * Exact follow-up an API client or agent should perform.
143
+ */
144
+ nextAction: ProfileUpdateResponse.NextAction | null;
145
+
146
+ object: 'x_write_action';
147
+
148
+ pollAfterMs: number | null;
149
+
150
+ /**
151
+ * Stable fingerprint and sanitized payload for replay checks.
152
+ */
153
+ request: ProfileUpdateResponse.Request;
154
+
155
+ /**
156
+ * Confirmed result produced by the write, when available.
157
+ */
158
+ result: ProfileUpdateResponse.Result | null;
159
+
160
+ /**
161
+ * True only when a new attempt can reasonably succeed.
162
+ */
163
+ retryable: boolean;
164
+
165
+ /**
166
+ * True only when no write was dispatched and a new idempotency key may be used.
167
+ */
168
+ safeToRetry: boolean;
169
+
170
+ sendDispatched: boolean;
171
+
172
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
173
+
174
+ statusUrl: string;
175
+
176
+ success: boolean;
177
+
178
+ /**
179
+ * Existing X resource targeted by the write, when applicable.
180
+ */
181
+ target: ProfileUpdateResponse.Target | null;
182
+
183
+ targetId: string | null;
184
+
185
+ terminal: boolean;
186
+
187
+ writeActionId: string;
188
+
189
+ /**
190
+ * Compatibility field for a confirmed community ID.
191
+ */
192
+ communityId?: string;
193
+
194
+ /**
195
+ * Confirmed community name when available.
196
+ */
197
+ communityName?: string;
198
+
199
+ completedAt?: string;
200
+
201
+ confirmationAttempts?: number;
202
+
203
+ confirmationCheckedAt?: string;
204
+
205
+ confirmedAt?: string;
206
+
207
+ createdAt?: string;
208
+
209
+ /**
210
+ * Structured recovery context for a failed write.
211
+ */
212
+ details?: { [key: string]: unknown };
213
+
214
+ error?: string;
215
+
216
+ /**
217
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
218
+ * retention deadline.
219
+ */
220
+ expiresAt?: string;
221
+
222
+ idempotent?: boolean;
223
+
224
+ /**
225
+ * Media count, kind, size, and billing details when used.
226
+ */
227
+ media?: { [key: string]: unknown };
228
+
229
+ /**
230
+ * Compatibility field for a confirmed media upload ID.
231
+ */
232
+ mediaId?: string;
233
+
234
+ /**
235
+ * Public media URL when the upload creates one.
236
+ */
237
+ mediaUrl?: string;
238
+
239
+ message?: string;
240
+
241
+ /**
242
+ * Compatibility field for a confirmed direct message ID.
243
+ */
244
+ messageId?: string;
245
+
246
+ requestHash?: string;
247
+
248
+ requestId?: string;
249
+
250
+ /**
251
+ * Compatibility result ID for other write actions.
252
+ */
253
+ resultId?: string;
254
+
255
+ /**
256
+ * Dispatch timestamp when the write reached execution.
257
+ */
258
+ sendDispatchedAt?: string;
259
+
260
+ /**
261
+ * Compatibility field for a confirmed tweet result ID.
262
+ */
263
+ tweetId?: string;
264
+
265
+ updatedAt?: string;
75
266
  }
76
267
 
268
+ export namespace ProfileUpdateResponse {
269
+ /**
270
+ * Connected account selected for the write.
271
+ */
272
+ export interface Account {
273
+ id: string;
274
+
275
+ username: string;
276
+ }
277
+
278
+ /**
279
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
280
+ * credit ledger. Pending or failed writes are not charged.
281
+ */
282
+ export interface Billing {
283
+ charged: boolean;
284
+
285
+ chargedCredits: string;
286
+
287
+ plannedCredits: string;
288
+
289
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
290
+ }
291
+
292
+ /**
293
+ * Exact follow-up an API client or agent should perform.
294
+ */
295
+ export interface NextAction {
296
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
297
+
298
+ afterMs?: number;
299
+
300
+ requiresNewIdempotencyKey?: boolean;
301
+
302
+ url?: string;
303
+ }
304
+
305
+ /**
306
+ * Stable fingerprint and sanitized payload for replay checks.
307
+ */
308
+ export interface Request {
309
+ /**
310
+ * Stable hash of account, action, target, and payload.
311
+ */
312
+ hash: string | null;
313
+
314
+ /**
315
+ * Exact sanitized payload dispatched for this action.
316
+ */
317
+ payload: { [key: string]: unknown } | null;
318
+ }
319
+
320
+ /**
321
+ * Confirmed result produced by the write, when available.
322
+ */
323
+ export interface Result {
324
+ id?: string;
325
+
326
+ state?: string;
327
+
328
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
329
+ }
330
+
331
+ /**
332
+ * Existing X resource targeted by the write, when applicable.
333
+ */
334
+ export interface Target {
335
+ id: string;
336
+
337
+ type: 'tweet' | 'user' | 'community';
338
+ }
339
+ }
340
+
341
+ /**
342
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
343
+ * the original Idempotency-Key returns this same record. Submit a new write only
344
+ * when safeToRetry is true, using a new key.
345
+ */
77
346
  export interface ProfileUpdateAvatarResponse {
78
- success: true;
347
+ id: string;
348
+
349
+ /**
350
+ * Connected account selected for the write.
351
+ */
352
+ account: ProfileUpdateAvatarResponse.Account | null;
353
+
354
+ action:
355
+ | 'create_tweet'
356
+ | 'delete_tweet'
357
+ | 'like'
358
+ | 'unlike'
359
+ | 'retweet'
360
+ | 'unretweet'
361
+ | 'follow'
362
+ | 'unfollow'
363
+ | 'remove_follower'
364
+ | 'send_dm'
365
+ | 'upload_media'
366
+ | 'update_profile'
367
+ | 'update_avatar'
368
+ | 'update_banner'
369
+ | 'create_community'
370
+ | 'delete_community'
371
+ | 'join_community'
372
+ | 'leave_community';
373
+
374
+ /**
375
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
376
+ * credit ledger. Pending or failed writes are not charged.
377
+ */
378
+ billing: ProfileUpdateAvatarResponse.Billing;
379
+
380
+ charged: boolean;
381
+
382
+ chargedCredits: string;
383
+
384
+ /**
385
+ * Exact follow-up an API client or agent should perform.
386
+ */
387
+ nextAction: ProfileUpdateAvatarResponse.NextAction | null;
388
+
389
+ object: 'x_write_action';
390
+
391
+ pollAfterMs: number | null;
392
+
393
+ /**
394
+ * Stable fingerprint and sanitized payload for replay checks.
395
+ */
396
+ request: ProfileUpdateAvatarResponse.Request;
397
+
398
+ /**
399
+ * Confirmed result produced by the write, when available.
400
+ */
401
+ result: ProfileUpdateAvatarResponse.Result | null;
402
+
403
+ /**
404
+ * True only when a new attempt can reasonably succeed.
405
+ */
406
+ retryable: boolean;
407
+
408
+ /**
409
+ * True only when no write was dispatched and a new idempotency key may be used.
410
+ */
411
+ safeToRetry: boolean;
412
+
413
+ sendDispatched: boolean;
414
+
415
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
416
+
417
+ statusUrl: string;
418
+
419
+ success: boolean;
420
+
421
+ /**
422
+ * Existing X resource targeted by the write, when applicable.
423
+ */
424
+ target: ProfileUpdateAvatarResponse.Target | null;
425
+
426
+ targetId: string | null;
427
+
428
+ terminal: boolean;
429
+
430
+ writeActionId: string;
431
+
432
+ /**
433
+ * Compatibility field for a confirmed community ID.
434
+ */
435
+ communityId?: string;
436
+
437
+ /**
438
+ * Confirmed community name when available.
439
+ */
440
+ communityName?: string;
441
+
442
+ completedAt?: string;
443
+
444
+ confirmationAttempts?: number;
445
+
446
+ confirmationCheckedAt?: string;
447
+
448
+ confirmedAt?: string;
449
+
450
+ createdAt?: string;
451
+
452
+ /**
453
+ * Structured recovery context for a failed write.
454
+ */
455
+ details?: { [key: string]: unknown };
456
+
457
+ error?: string;
458
+
459
+ /**
460
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
461
+ * retention deadline.
462
+ */
463
+ expiresAt?: string;
464
+
465
+ idempotent?: boolean;
466
+
467
+ /**
468
+ * Media count, kind, size, and billing details when used.
469
+ */
470
+ media?: { [key: string]: unknown };
471
+
472
+ /**
473
+ * Compatibility field for a confirmed media upload ID.
474
+ */
475
+ mediaId?: string;
476
+
477
+ /**
478
+ * Public media URL when the upload creates one.
479
+ */
480
+ mediaUrl?: string;
481
+
482
+ message?: string;
483
+
484
+ /**
485
+ * Compatibility field for a confirmed direct message ID.
486
+ */
487
+ messageId?: string;
488
+
489
+ requestHash?: string;
490
+
491
+ requestId?: string;
492
+
493
+ /**
494
+ * Compatibility result ID for other write actions.
495
+ */
496
+ resultId?: string;
497
+
498
+ /**
499
+ * Dispatch timestamp when the write reached execution.
500
+ */
501
+ sendDispatchedAt?: string;
502
+
503
+ /**
504
+ * Compatibility field for a confirmed tweet result ID.
505
+ */
506
+ tweetId?: string;
507
+
508
+ updatedAt?: string;
79
509
  }
80
510
 
511
+ export namespace ProfileUpdateAvatarResponse {
512
+ /**
513
+ * Connected account selected for the write.
514
+ */
515
+ export interface Account {
516
+ id: string;
517
+
518
+ username: string;
519
+ }
520
+
521
+ /**
522
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
523
+ * credit ledger. Pending or failed writes are not charged.
524
+ */
525
+ export interface Billing {
526
+ charged: boolean;
527
+
528
+ chargedCredits: string;
529
+
530
+ plannedCredits: string;
531
+
532
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
533
+ }
534
+
535
+ /**
536
+ * Exact follow-up an API client or agent should perform.
537
+ */
538
+ export interface NextAction {
539
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
540
+
541
+ afterMs?: number;
542
+
543
+ requiresNewIdempotencyKey?: boolean;
544
+
545
+ url?: string;
546
+ }
547
+
548
+ /**
549
+ * Stable fingerprint and sanitized payload for replay checks.
550
+ */
551
+ export interface Request {
552
+ /**
553
+ * Stable hash of account, action, target, and payload.
554
+ */
555
+ hash: string | null;
556
+
557
+ /**
558
+ * Exact sanitized payload dispatched for this action.
559
+ */
560
+ payload: { [key: string]: unknown } | null;
561
+ }
562
+
563
+ /**
564
+ * Confirmed result produced by the write, when available.
565
+ */
566
+ export interface Result {
567
+ id?: string;
568
+
569
+ state?: string;
570
+
571
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
572
+ }
573
+
574
+ /**
575
+ * Existing X resource targeted by the write, when applicable.
576
+ */
577
+ export interface Target {
578
+ id: string;
579
+
580
+ type: 'tweet' | 'user' | 'community';
581
+ }
582
+ }
583
+
584
+ /**
585
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
586
+ * the original Idempotency-Key returns this same record. Submit a new write only
587
+ * when safeToRetry is true, using a new key.
588
+ */
81
589
  export interface ProfileUpdateBannerResponse {
82
- success: true;
590
+ id: string;
591
+
592
+ /**
593
+ * Connected account selected for the write.
594
+ */
595
+ account: ProfileUpdateBannerResponse.Account | null;
596
+
597
+ action:
598
+ | 'create_tweet'
599
+ | 'delete_tweet'
600
+ | 'like'
601
+ | 'unlike'
602
+ | 'retweet'
603
+ | 'unretweet'
604
+ | 'follow'
605
+ | 'unfollow'
606
+ | 'remove_follower'
607
+ | 'send_dm'
608
+ | 'upload_media'
609
+ | 'update_profile'
610
+ | 'update_avatar'
611
+ | 'update_banner'
612
+ | 'create_community'
613
+ | 'delete_community'
614
+ | 'join_community'
615
+ | 'leave_community';
616
+
617
+ /**
618
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
619
+ * credit ledger. Pending or failed writes are not charged.
620
+ */
621
+ billing: ProfileUpdateBannerResponse.Billing;
622
+
623
+ charged: boolean;
624
+
625
+ chargedCredits: string;
626
+
627
+ /**
628
+ * Exact follow-up an API client or agent should perform.
629
+ */
630
+ nextAction: ProfileUpdateBannerResponse.NextAction | null;
631
+
632
+ object: 'x_write_action';
633
+
634
+ pollAfterMs: number | null;
635
+
636
+ /**
637
+ * Stable fingerprint and sanitized payload for replay checks.
638
+ */
639
+ request: ProfileUpdateBannerResponse.Request;
640
+
641
+ /**
642
+ * Confirmed result produced by the write, when available.
643
+ */
644
+ result: ProfileUpdateBannerResponse.Result | null;
645
+
646
+ /**
647
+ * True only when a new attempt can reasonably succeed.
648
+ */
649
+ retryable: boolean;
650
+
651
+ /**
652
+ * True only when no write was dispatched and a new idempotency key may be used.
653
+ */
654
+ safeToRetry: boolean;
655
+
656
+ sendDispatched: boolean;
657
+
658
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
659
+
660
+ statusUrl: string;
661
+
662
+ success: boolean;
663
+
664
+ /**
665
+ * Existing X resource targeted by the write, when applicable.
666
+ */
667
+ target: ProfileUpdateBannerResponse.Target | null;
668
+
669
+ targetId: string | null;
670
+
671
+ terminal: boolean;
672
+
673
+ writeActionId: string;
674
+
675
+ /**
676
+ * Compatibility field for a confirmed community ID.
677
+ */
678
+ communityId?: string;
679
+
680
+ /**
681
+ * Confirmed community name when available.
682
+ */
683
+ communityName?: string;
684
+
685
+ completedAt?: string;
686
+
687
+ confirmationAttempts?: number;
688
+
689
+ confirmationCheckedAt?: string;
690
+
691
+ confirmedAt?: string;
692
+
693
+ createdAt?: string;
694
+
695
+ /**
696
+ * Structured recovery context for a failed write.
697
+ */
698
+ details?: { [key: string]: unknown };
699
+
700
+ error?: string;
701
+
702
+ /**
703
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
704
+ * retention deadline.
705
+ */
706
+ expiresAt?: string;
707
+
708
+ idempotent?: boolean;
709
+
710
+ /**
711
+ * Media count, kind, size, and billing details when used.
712
+ */
713
+ media?: { [key: string]: unknown };
714
+
715
+ /**
716
+ * Compatibility field for a confirmed media upload ID.
717
+ */
718
+ mediaId?: string;
719
+
720
+ /**
721
+ * Public media URL when the upload creates one.
722
+ */
723
+ mediaUrl?: string;
724
+
725
+ message?: string;
726
+
727
+ /**
728
+ * Compatibility field for a confirmed direct message ID.
729
+ */
730
+ messageId?: string;
731
+
732
+ requestHash?: string;
733
+
734
+ requestId?: string;
735
+
736
+ /**
737
+ * Compatibility result ID for other write actions.
738
+ */
739
+ resultId?: string;
740
+
741
+ /**
742
+ * Dispatch timestamp when the write reached execution.
743
+ */
744
+ sendDispatchedAt?: string;
745
+
746
+ /**
747
+ * Compatibility field for a confirmed tweet result ID.
748
+ */
749
+ tweetId?: string;
750
+
751
+ updatedAt?: string;
752
+ }
753
+
754
+ export namespace ProfileUpdateBannerResponse {
755
+ /**
756
+ * Connected account selected for the write.
757
+ */
758
+ export interface Account {
759
+ id: string;
760
+
761
+ username: string;
762
+ }
763
+
764
+ /**
765
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
766
+ * credit ledger. Pending or failed writes are not charged.
767
+ */
768
+ export interface Billing {
769
+ charged: boolean;
770
+
771
+ chargedCredits: string;
772
+
773
+ plannedCredits: string;
774
+
775
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
776
+ }
777
+
778
+ /**
779
+ * Exact follow-up an API client or agent should perform.
780
+ */
781
+ export interface NextAction {
782
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
783
+
784
+ afterMs?: number;
785
+
786
+ requiresNewIdempotencyKey?: boolean;
787
+
788
+ url?: string;
789
+ }
790
+
791
+ /**
792
+ * Stable fingerprint and sanitized payload for replay checks.
793
+ */
794
+ export interface Request {
795
+ /**
796
+ * Stable hash of account, action, target, and payload.
797
+ */
798
+ hash: string | null;
799
+
800
+ /**
801
+ * Exact sanitized payload dispatched for this action.
802
+ */
803
+ payload: { [key: string]: unknown } | null;
804
+ }
805
+
806
+ /**
807
+ * Confirmed result produced by the write, when available.
808
+ */
809
+ export interface Result {
810
+ id?: string;
811
+
812
+ state?: string;
813
+
814
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
815
+ }
816
+
817
+ /**
818
+ * Existing X resource targeted by the write, when applicable.
819
+ */
820
+ export interface Target {
821
+ id: string;
822
+
823
+ type: 'tweet' | 'user' | 'community';
824
+ }
83
825
  }
84
826
 
85
827
  export interface ProfileUpdateParams {
86
828
  /**
87
- * X account (@username or ID) to update profile
829
+ * Body param: X account (@username or ID) to update profile
88
830
  */
89
831
  account: string;
90
832
 
91
833
  /**
92
- * Bio description
834
+ * Header param: Generate one unique value for each intended write. Reuse it only
835
+ * when retrying the exact same account, action, target, and payload. A reused key
836
+ * returns the original action. Reusing it with different input returns 409. Replay
837
+ * protection remains active for at least 90 days.
838
+ */
839
+ 'Idempotency-Key': string;
840
+
841
+ /**
842
+ * Body param: Bio description
93
843
  */
94
844
  description?: string;
95
845
 
846
+ /**
847
+ * Body param
848
+ */
96
849
  location?: string;
97
850
 
98
851
  /**
99
- * Display name
852
+ * Body param: Display name
100
853
  */
101
854
  name?: string;
102
855
 
103
856
  /**
104
- * Website URL
857
+ * Body param: Website URL
105
858
  */
106
859
  url?: string;
107
860
  }
108
861
 
109
862
  export interface ProfileUpdateAvatarParams {
110
863
  /**
111
- * X account (@username or ID) receiving avatar from URL
864
+ * Body param: X account (@username or ID) receiving avatar from URL
112
865
  */
113
866
  account: string;
114
867
 
115
868
  /**
116
- * HTTPS URL to the avatar image to download
869
+ * Body param: HTTPS URL to the avatar image to download
117
870
  */
118
871
  url: string;
872
+
873
+ /**
874
+ * Header param: Generate one unique value for each intended write. Reuse it only
875
+ * when retrying the exact same account, action, target, and payload. A reused key
876
+ * returns the original action. Reusing it with different input returns 409. Replay
877
+ * protection remains active for at least 90 days.
878
+ */
879
+ 'Idempotency-Key': string;
119
880
  }
120
881
 
121
882
  export interface ProfileUpdateBannerParams {
122
883
  /**
123
- * X account (@username or ID) receiving banner from URL
884
+ * Body param: X account (@username or ID) receiving banner from URL
124
885
  */
125
886
  account: string;
126
887
 
127
888
  /**
128
- * HTTPS URL to the banner image to download
889
+ * Body param: HTTPS URL to the banner image to download
129
890
  */
130
891
  url: string;
892
+
893
+ /**
894
+ * Header param: Generate one unique value for each intended write. Reuse it only
895
+ * when retrying the exact same account, action, target, and payload. A reused key
896
+ * returns the original action. Reusing it with different input returns 409. Replay
897
+ * protection remains active for at least 90 days.
898
+ */
899
+ 'Idempotency-Key': string;
131
900
  }
132
901
 
133
902
  export declare namespace Profile {