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.
- package/CHANGELOG.md +21 -0
- package/README.md +1 -0
- package/client.d.mts +1 -1
- package/client.d.ts +1 -1
- package/client.js +1 -1
- package/client.mjs +1 -1
- package/package.json +1 -1
- package/resources/account.d.mts +2 -2
- package/resources/account.d.ts +2 -2
- package/resources/compose.d.mts +186 -65
- package/resources/compose.d.mts.map +1 -1
- package/resources/compose.d.ts +186 -65
- package/resources/compose.d.ts.map +1 -1
- package/resources/compose.js +5 -2
- package/resources/compose.js.map +1 -1
- package/resources/compose.mjs +5 -2
- package/resources/compose.mjs.map +1 -1
- package/resources/credits.d.mts +1 -1
- package/resources/credits.d.ts +1 -1
- package/resources/extractions.d.mts +4 -4
- package/resources/extractions.d.ts +4 -4
- package/resources/guest-wallets.d.mts +2 -2
- package/resources/guest-wallets.d.ts +2 -2
- package/resources/monitors/keywords.d.mts +4 -4
- package/resources/monitors/keywords.d.ts +4 -4
- package/resources/monitors/keywords.js +4 -4
- package/resources/monitors/keywords.mjs +4 -4
- package/resources/monitors/monitors.d.mts +5 -4
- package/resources/monitors/monitors.d.mts.map +1 -1
- package/resources/monitors/monitors.d.ts +5 -4
- package/resources/monitors/monitors.d.ts.map +1 -1
- package/resources/monitors/monitors.js +5 -4
- package/resources/monitors/monitors.js.map +1 -1
- package/resources/monitors/monitors.mjs +5 -4
- package/resources/monitors/monitors.mjs.map +1 -1
- package/resources/shared.d.mts +24 -8
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +24 -8
- package/resources/shared.d.ts.map +1 -1
- package/resources/support/tickets.d.mts +67 -4
- package/resources/support/tickets.d.mts.map +1 -1
- package/resources/support/tickets.d.ts +67 -4
- package/resources/support/tickets.d.ts.map +1 -1
- package/resources/support/tickets.js +22 -4
- package/resources/support/tickets.js.map +1 -1
- package/resources/support/tickets.mjs +22 -4
- package/resources/support/tickets.mjs.map +1 -1
- package/resources/x/account-connection-challenges.d.mts +1 -1
- package/resources/x/account-connection-challenges.d.ts +1 -1
- package/resources/x/account-connection-challenges.js +1 -1
- package/resources/x/account-connection-challenges.mjs +1 -1
- package/resources/x/accounts.d.mts +9 -6
- package/resources/x/accounts.d.mts.map +1 -1
- package/resources/x/accounts.d.ts +9 -6
- package/resources/x/accounts.d.ts.map +1 -1
- package/resources/x/accounts.js +4 -2
- package/resources/x/accounts.js.map +1 -1
- package/resources/x/accounts.mjs +4 -2
- package/resources/x/accounts.mjs.map +1 -1
- package/resources/x/communities/communities.d.mts +360 -10
- package/resources/x/communities/communities.d.mts.map +1 -1
- package/resources/x/communities/communities.d.ts +360 -10
- package/resources/x/communities/communities.d.ts.map +1 -1
- package/resources/x/communities/communities.js +17 -4
- package/resources/x/communities/communities.js.map +1 -1
- package/resources/x/communities/communities.mjs +17 -4
- package/resources/x/communities/communities.mjs.map +1 -1
- package/resources/x/communities/join.d.mts +361 -7
- package/resources/x/communities/join.d.mts.map +1 -1
- package/resources/x/communities/join.d.ts +361 -7
- package/resources/x/communities/join.d.ts.map +1 -1
- package/resources/x/communities/join.js +20 -5
- package/resources/x/communities/join.js.map +1 -1
- package/resources/x/communities/join.mjs +20 -5
- package/resources/x/communities/join.mjs.map +1 -1
- package/resources/x/dm.d.mts +183 -5
- package/resources/x/dm.d.mts.map +1 -1
- package/resources/x/dm.d.ts +183 -5
- package/resources/x/dm.d.ts.map +1 -1
- package/resources/x/dm.js +9 -2
- package/resources/x/dm.js.map +1 -1
- package/resources/x/dm.mjs +9 -2
- package/resources/x/dm.mjs.map +1 -1
- package/resources/x/media.d.mts +178 -10
- package/resources/x/media.d.mts.map +1 -1
- package/resources/x/media.d.ts +178 -10
- package/resources/x/media.d.ts.map +1 -1
- package/resources/x/media.js +9 -5
- package/resources/x/media.js.map +1 -1
- package/resources/x/media.mjs +9 -5
- package/resources/x/media.mjs.map +1 -1
- package/resources/x/profile.d.mts +545 -14
- package/resources/x/profile.d.mts.map +1 -1
- package/resources/x/profile.d.ts +545 -14
- package/resources/x/profile.d.ts.map +1 -1
- package/resources/x/profile.js +25 -6
- package/resources/x/profile.js.map +1 -1
- package/resources/x/profile.mjs +25 -6
- package/resources/x/profile.mjs.map +1 -1
- package/resources/x/tweets/like.d.mts +358 -6
- package/resources/x/tweets/like.d.mts.map +1 -1
- package/resources/x/tweets/like.d.ts +358 -6
- package/resources/x/tweets/like.d.ts.map +1 -1
- package/resources/x/tweets/like.js +17 -4
- package/resources/x/tweets/like.js.map +1 -1
- package/resources/x/tweets/like.mjs +17 -4
- package/resources/x/tweets/like.mjs.map +1 -1
- package/resources/x/tweets/retweet.d.mts +358 -6
- package/resources/x/tweets/retweet.d.mts.map +1 -1
- package/resources/x/tweets/retweet.d.ts +358 -6
- package/resources/x/tweets/retweet.d.ts.map +1 -1
- package/resources/x/tweets/retweet.js +17 -4
- package/resources/x/tweets/retweet.js.map +1 -1
- package/resources/x/tweets/retweet.mjs +17 -4
- package/resources/x/tweets/retweet.mjs.map +1 -1
- package/resources/x/tweets/tweets.d.mts +376 -18
- package/resources/x/tweets/tweets.d.mts.map +1 -1
- package/resources/x/tweets/tweets.d.ts +376 -18
- package/resources/x/tweets/tweets.d.ts.map +1 -1
- package/resources/x/tweets/tweets.js +25 -6
- package/resources/x/tweets/tweets.js.map +1 -1
- package/resources/x/tweets/tweets.mjs +25 -6
- package/resources/x/tweets/tweets.mjs.map +1 -1
- package/resources/x/users/follow.d.mts +361 -7
- package/resources/x/users/follow.d.mts.map +1 -1
- package/resources/x/users/follow.d.ts +361 -7
- package/resources/x/users/follow.d.ts.map +1 -1
- package/resources/x/users/follow.js +20 -5
- package/resources/x/users/follow.js.map +1 -1
- package/resources/x/users/follow.mjs +20 -5
- package/resources/x/users/follow.mjs.map +1 -1
- package/resources/x/users/users.d.mts +181 -5
- package/resources/x/users/users.d.mts.map +1 -1
- package/resources/x/users/users.d.ts +181 -5
- package/resources/x/users/users.d.ts.map +1 -1
- package/resources/x/users/users.js +9 -2
- package/resources/x/users/users.js.map +1 -1
- package/resources/x/users/users.mjs +9 -2
- package/resources/x/users/users.mjs.map +1 -1
- package/resources/x/write-actions.d.mts +155 -12
- package/resources/x/write-actions.d.mts.map +1 -1
- package/resources/x/write-actions.d.ts +155 -12
- package/resources/x/write-actions.d.ts.map +1 -1
- package/src/client.ts +1 -1
- package/src/resources/account.ts +2 -2
- package/src/resources/compose.ts +232 -65
- package/src/resources/credits.ts +1 -1
- package/src/resources/extractions.ts +4 -4
- package/src/resources/guest-wallets.ts +2 -2
- package/src/resources/monitors/keywords.ts +4 -4
- package/src/resources/monitors/monitors.ts +5 -4
- package/src/resources/shared.ts +93 -9
- package/src/resources/support/tickets.ts +122 -6
- package/src/resources/x/account-connection-challenges.ts +1 -1
- package/src/resources/x/accounts.ts +9 -6
- package/src/resources/x/communities/communities.ts +515 -12
- package/src/resources/x/communities/join.ts +518 -9
- package/src/resources/x/dm.ts +261 -6
- package/src/resources/x/media.ts +258 -11
- package/src/resources/x/profile.ts +786 -17
- package/src/resources/x/tweets/like.ts +515 -8
- package/src/resources/x/tweets/retweet.ts +523 -8
- package/src/resources/x/tweets/tweets.ts +529 -23
- package/src/resources/x/users/follow.ts +518 -9
- package/src/resources/x/users/users.ts +260 -6
- package/src/resources/x/write-actions.ts +207 -14
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- 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(
|
|
35
|
-
|
|
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,
|
|
75
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Compatibility field for a confirmed tweet result ID.
|
|
497
|
+
*/
|
|
498
|
+
tweetId?: string;
|
|
329
499
|
|
|
330
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|