x-twitter-scraper 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -0
  3. package/package.json +1 -1
  4. package/resources/credits.d.mts +1 -1
  5. package/resources/credits.d.ts +1 -1
  6. package/resources/extractions.d.mts +4 -4
  7. package/resources/extractions.d.ts +4 -4
  8. package/resources/guest-wallets.d.mts +2 -2
  9. package/resources/guest-wallets.d.ts +2 -2
  10. package/resources/shared.d.mts +24 -8
  11. package/resources/shared.d.mts.map +1 -1
  12. package/resources/shared.d.ts +24 -8
  13. package/resources/shared.d.ts.map +1 -1
  14. package/resources/support/tickets.d.mts +67 -4
  15. package/resources/support/tickets.d.mts.map +1 -1
  16. package/resources/support/tickets.d.ts +67 -4
  17. package/resources/support/tickets.d.ts.map +1 -1
  18. package/resources/support/tickets.js +22 -4
  19. package/resources/support/tickets.js.map +1 -1
  20. package/resources/support/tickets.mjs +22 -4
  21. package/resources/support/tickets.mjs.map +1 -1
  22. package/resources/x/account-connection-challenges.d.mts +1 -1
  23. package/resources/x/account-connection-challenges.d.ts +1 -1
  24. package/resources/x/account-connection-challenges.js +1 -1
  25. package/resources/x/account-connection-challenges.mjs +1 -1
  26. package/resources/x/accounts.d.mts +9 -6
  27. package/resources/x/accounts.d.mts.map +1 -1
  28. package/resources/x/accounts.d.ts +9 -6
  29. package/resources/x/accounts.d.ts.map +1 -1
  30. package/resources/x/accounts.js +4 -2
  31. package/resources/x/accounts.js.map +1 -1
  32. package/resources/x/accounts.mjs +4 -2
  33. package/resources/x/accounts.mjs.map +1 -1
  34. package/resources/x/communities/communities.d.mts +360 -10
  35. package/resources/x/communities/communities.d.mts.map +1 -1
  36. package/resources/x/communities/communities.d.ts +360 -10
  37. package/resources/x/communities/communities.d.ts.map +1 -1
  38. package/resources/x/communities/communities.js +17 -4
  39. package/resources/x/communities/communities.js.map +1 -1
  40. package/resources/x/communities/communities.mjs +17 -4
  41. package/resources/x/communities/communities.mjs.map +1 -1
  42. package/resources/x/communities/join.d.mts +361 -7
  43. package/resources/x/communities/join.d.mts.map +1 -1
  44. package/resources/x/communities/join.d.ts +361 -7
  45. package/resources/x/communities/join.d.ts.map +1 -1
  46. package/resources/x/communities/join.js +20 -5
  47. package/resources/x/communities/join.js.map +1 -1
  48. package/resources/x/communities/join.mjs +20 -5
  49. package/resources/x/communities/join.mjs.map +1 -1
  50. package/resources/x/dm.d.mts +183 -5
  51. package/resources/x/dm.d.mts.map +1 -1
  52. package/resources/x/dm.d.ts +183 -5
  53. package/resources/x/dm.d.ts.map +1 -1
  54. package/resources/x/dm.js +9 -2
  55. package/resources/x/dm.js.map +1 -1
  56. package/resources/x/dm.mjs +9 -2
  57. package/resources/x/dm.mjs.map +1 -1
  58. package/resources/x/media.d.mts +178 -10
  59. package/resources/x/media.d.mts.map +1 -1
  60. package/resources/x/media.d.ts +178 -10
  61. package/resources/x/media.d.ts.map +1 -1
  62. package/resources/x/media.js +9 -5
  63. package/resources/x/media.js.map +1 -1
  64. package/resources/x/media.mjs +9 -5
  65. package/resources/x/media.mjs.map +1 -1
  66. package/resources/x/profile.d.mts +545 -14
  67. package/resources/x/profile.d.mts.map +1 -1
  68. package/resources/x/profile.d.ts +545 -14
  69. package/resources/x/profile.d.ts.map +1 -1
  70. package/resources/x/profile.js +25 -6
  71. package/resources/x/profile.js.map +1 -1
  72. package/resources/x/profile.mjs +25 -6
  73. package/resources/x/profile.mjs.map +1 -1
  74. package/resources/x/tweets/like.d.mts +358 -6
  75. package/resources/x/tweets/like.d.mts.map +1 -1
  76. package/resources/x/tweets/like.d.ts +358 -6
  77. package/resources/x/tweets/like.d.ts.map +1 -1
  78. package/resources/x/tweets/like.js +17 -4
  79. package/resources/x/tweets/like.js.map +1 -1
  80. package/resources/x/tweets/like.mjs +17 -4
  81. package/resources/x/tweets/like.mjs.map +1 -1
  82. package/resources/x/tweets/retweet.d.mts +358 -6
  83. package/resources/x/tweets/retweet.d.mts.map +1 -1
  84. package/resources/x/tweets/retweet.d.ts +358 -6
  85. package/resources/x/tweets/retweet.d.ts.map +1 -1
  86. package/resources/x/tweets/retweet.js +17 -4
  87. package/resources/x/tweets/retweet.js.map +1 -1
  88. package/resources/x/tweets/retweet.mjs +17 -4
  89. package/resources/x/tweets/retweet.mjs.map +1 -1
  90. package/resources/x/tweets/tweets.d.mts +376 -18
  91. package/resources/x/tweets/tweets.d.mts.map +1 -1
  92. package/resources/x/tweets/tweets.d.ts +376 -18
  93. package/resources/x/tweets/tweets.d.ts.map +1 -1
  94. package/resources/x/tweets/tweets.js +25 -6
  95. package/resources/x/tweets/tweets.js.map +1 -1
  96. package/resources/x/tweets/tweets.mjs +25 -6
  97. package/resources/x/tweets/tweets.mjs.map +1 -1
  98. package/resources/x/users/follow.d.mts +361 -7
  99. package/resources/x/users/follow.d.mts.map +1 -1
  100. package/resources/x/users/follow.d.ts +361 -7
  101. package/resources/x/users/follow.d.ts.map +1 -1
  102. package/resources/x/users/follow.js +20 -5
  103. package/resources/x/users/follow.js.map +1 -1
  104. package/resources/x/users/follow.mjs +20 -5
  105. package/resources/x/users/follow.mjs.map +1 -1
  106. package/resources/x/users/users.d.mts +181 -5
  107. package/resources/x/users/users.d.mts.map +1 -1
  108. package/resources/x/users/users.d.ts +181 -5
  109. package/resources/x/users/users.d.ts.map +1 -1
  110. package/resources/x/users/users.js +9 -2
  111. package/resources/x/users/users.js.map +1 -1
  112. package/resources/x/users/users.mjs +9 -2
  113. package/resources/x/users/users.mjs.map +1 -1
  114. package/resources/x/write-actions.d.mts +155 -12
  115. package/resources/x/write-actions.d.mts.map +1 -1
  116. package/resources/x/write-actions.d.ts +155 -12
  117. package/resources/x/write-actions.d.ts.map +1 -1
  118. package/src/resources/credits.ts +1 -1
  119. package/src/resources/extractions.ts +4 -4
  120. package/src/resources/guest-wallets.ts +2 -2
  121. package/src/resources/shared.ts +93 -9
  122. package/src/resources/support/tickets.ts +122 -6
  123. package/src/resources/x/account-connection-challenges.ts +1 -1
  124. package/src/resources/x/accounts.ts +9 -6
  125. package/src/resources/x/communities/communities.ts +515 -12
  126. package/src/resources/x/communities/join.ts +518 -9
  127. package/src/resources/x/dm.ts +261 -6
  128. package/src/resources/x/media.ts +258 -11
  129. package/src/resources/x/profile.ts +786 -17
  130. package/src/resources/x/tweets/like.ts +515 -8
  131. package/src/resources/x/tweets/retweet.ts +523 -8
  132. package/src/resources/x/tweets/tweets.ts +529 -23
  133. package/src/resources/x/users/follow.ts +518 -9
  134. package/src/resources/x/users/users.ts +260 -6
  135. package/src/resources/x/write-actions.ts +207 -14
  136. package/src/version.ts +1 -1
  137. package/version.d.mts +1 -1
  138. package/version.d.ts +1 -1
  139. package/version.js +1 -1
  140. package/version.mjs +1 -1
@@ -22,11 +22,12 @@ export declare class Dm extends APIResource {
22
22
  * const response = await client.x.dm.send('userId', {
23
23
  * account: '@elonmusk',
24
24
  * text: 'Example text content',
25
+ * 'Idempotency-Key': 'Idempotency-Key',
25
26
  * media_ids: ['1234567890123456789'],
26
27
  * });
27
28
  * ```
28
29
  */
29
- send(userID: string, body: DmSendParams, options?: RequestOptions): APIPromise<DmSendResponse>;
30
+ send(userID: string, params: DmSendParams, options?: RequestOptions): APIPromise<DmSendResponse>;
30
31
  }
31
32
  export interface DmRetrieveHistoryResponse {
32
33
  has_next_page: boolean;
@@ -47,9 +48,176 @@ export declare namespace DmRetrieveHistoryResponse {
47
48
  text?: string;
48
49
  }
49
50
  }
51
+ /**
52
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
53
+ * the original Idempotency-Key returns this same record. Submit a new write only
54
+ * when safeToRetry is true, using a new key.
55
+ */
50
56
  export interface DmSendResponse {
51
- messageId: string;
52
- success: true;
57
+ id: string;
58
+ /**
59
+ * Connected account selected for the write.
60
+ */
61
+ account: DmSendResponse.Account | null;
62
+ action: 'create_tweet' | 'delete_tweet' | 'like' | 'unlike' | 'retweet' | 'unretweet' | 'follow' | 'unfollow' | 'remove_follower' | 'send_dm' | 'upload_media' | 'update_profile' | 'update_avatar' | 'update_banner' | 'create_community' | 'delete_community' | 'join_community' | 'leave_community';
63
+ /**
64
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
65
+ * credit ledger. Pending or failed writes are not charged.
66
+ */
67
+ billing: DmSendResponse.Billing;
68
+ charged: boolean;
69
+ chargedCredits: string;
70
+ /**
71
+ * Exact follow-up an API client or agent should perform.
72
+ */
73
+ nextAction: DmSendResponse.NextAction | null;
74
+ object: 'x_write_action';
75
+ pollAfterMs: number | null;
76
+ /**
77
+ * Stable fingerprint and sanitized payload for replay checks.
78
+ */
79
+ request: DmSendResponse.Request;
80
+ /**
81
+ * Confirmed result produced by the write, when available.
82
+ */
83
+ result: DmSendResponse.Result | null;
84
+ /**
85
+ * True only when a new attempt can reasonably succeed.
86
+ */
87
+ retryable: boolean;
88
+ /**
89
+ * True only when no write was dispatched and a new idempotency key may be used.
90
+ */
91
+ safeToRetry: boolean;
92
+ sendDispatched: boolean;
93
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
94
+ statusUrl: string;
95
+ success: boolean;
96
+ /**
97
+ * Existing X resource targeted by the write, when applicable.
98
+ */
99
+ target: DmSendResponse.Target | null;
100
+ targetId: string | null;
101
+ terminal: boolean;
102
+ writeActionId: string;
103
+ /**
104
+ * Compatibility field for a confirmed community ID.
105
+ */
106
+ communityId?: string;
107
+ /**
108
+ * Confirmed community name when available.
109
+ */
110
+ communityName?: string;
111
+ completedAt?: string;
112
+ confirmationAttempts?: number;
113
+ confirmationCheckedAt?: string;
114
+ confirmedAt?: string;
115
+ createdAt?: string;
116
+ /**
117
+ * Structured recovery context for a failed write.
118
+ */
119
+ details?: {
120
+ [key: string]: unknown;
121
+ };
122
+ error?: string;
123
+ /**
124
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
125
+ * retention deadline.
126
+ */
127
+ expiresAt?: string;
128
+ idempotent?: boolean;
129
+ /**
130
+ * Media count, kind, size, and billing details when used.
131
+ */
132
+ media?: {
133
+ [key: string]: unknown;
134
+ };
135
+ /**
136
+ * Compatibility field for a confirmed media upload ID.
137
+ */
138
+ mediaId?: string;
139
+ /**
140
+ * Public media URL when the upload creates one.
141
+ */
142
+ mediaUrl?: string;
143
+ message?: string;
144
+ /**
145
+ * Compatibility field for a confirmed direct message ID.
146
+ */
147
+ messageId?: string;
148
+ requestHash?: string;
149
+ requestId?: string;
150
+ /**
151
+ * Compatibility result ID for other write actions.
152
+ */
153
+ resultId?: string;
154
+ /**
155
+ * Dispatch timestamp when the write reached execution.
156
+ */
157
+ sendDispatchedAt?: string;
158
+ /**
159
+ * Compatibility field for a confirmed tweet result ID.
160
+ */
161
+ tweetId?: string;
162
+ updatedAt?: string;
163
+ }
164
+ export declare namespace DmSendResponse {
165
+ /**
166
+ * Connected account selected for the write.
167
+ */
168
+ interface Account {
169
+ id: string;
170
+ username: string;
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
+ interface Billing {
177
+ charged: boolean;
178
+ chargedCredits: string;
179
+ plannedCredits: string;
180
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
181
+ }
182
+ /**
183
+ * Exact follow-up an API client or agent should perform.
184
+ */
185
+ interface NextAction {
186
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
187
+ afterMs?: number;
188
+ requiresNewIdempotencyKey?: boolean;
189
+ url?: string;
190
+ }
191
+ /**
192
+ * Stable fingerprint and sanitized payload for replay checks.
193
+ */
194
+ interface Request {
195
+ /**
196
+ * Stable hash of account, action, target, and payload.
197
+ */
198
+ hash: string | null;
199
+ /**
200
+ * Exact sanitized payload dispatched for this action.
201
+ */
202
+ payload: {
203
+ [key: string]: unknown;
204
+ } | null;
205
+ }
206
+ /**
207
+ * Confirmed result produced by the write, when available.
208
+ */
209
+ interface Result {
210
+ id?: string;
211
+ state?: string;
212
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
213
+ }
214
+ /**
215
+ * Existing X resource targeted by the write, when applicable.
216
+ */
217
+ interface Target {
218
+ id: string;
219
+ type: 'tweet' | 'user' | 'community';
220
+ }
53
221
  }
54
222
  export interface DmRetrieveHistoryParams {
55
223
  /**
@@ -68,12 +236,22 @@ export interface DmRetrieveHistoryParams {
68
236
  }
69
237
  export interface DmSendParams {
70
238
  /**
71
- * X account (@username or ID) sending the DM
239
+ * Body param: X account (@username or ID) sending the DM
72
240
  */
73
241
  account: string;
242
+ /**
243
+ * Body param
244
+ */
74
245
  text: string;
75
246
  /**
76
- * Optional array containing exactly 1 uploaded media ID.
247
+ * Header param: Generate one unique value for each intended write. Reuse it only
248
+ * when retrying the exact same account, action, target, and payload. A reused key
249
+ * returns the original action. Reusing it with different input returns 409. Replay
250
+ * protection remains active for at least 90 days.
251
+ */
252
+ 'Idempotency-Key': string;
253
+ /**
254
+ * Body param: Optional array containing exactly 1 uploaded media ID.
77
255
  */
78
256
  media_ids?: Array<string>;
79
257
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dm.d.mts","sourceRoot":"","sources":["../../src/resources/x/dm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAGhE,qBAAa,EAAG,SAAQ,WAAW;IACjC;;;;;;;;;;OAUG;IACH,eAAe,CACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,uBAAuB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;IAIxC;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;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;;WAEG;QACH,OAAO,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,GAAG,IAAI,CAAC;KAC5C;IAED;;OAEG;IACH,UAAiB,MAAM;QACrB,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf,IAAI,CAAC,EAAE,OAAO,GAAG,gBAAgB,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,CAAC;KAC5E;IAED;;OAEG;IACH,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QAEX,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;KACtC;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,YAAY,IAAI,YAAY,GAClC,CAAC;CACH"}
@@ -22,11 +22,12 @@ export declare class Dm extends APIResource {
22
22
  * const response = await client.x.dm.send('userId', {
23
23
  * account: '@elonmusk',
24
24
  * text: 'Example text content',
25
+ * 'Idempotency-Key': 'Idempotency-Key',
25
26
  * media_ids: ['1234567890123456789'],
26
27
  * });
27
28
  * ```
28
29
  */
29
- send(userID: string, body: DmSendParams, options?: RequestOptions): APIPromise<DmSendResponse>;
30
+ send(userID: string, params: DmSendParams, options?: RequestOptions): APIPromise<DmSendResponse>;
30
31
  }
31
32
  export interface DmRetrieveHistoryResponse {
32
33
  has_next_page: boolean;
@@ -47,9 +48,176 @@ export declare namespace DmRetrieveHistoryResponse {
47
48
  text?: string;
48
49
  }
49
50
  }
51
+ /**
52
+ * Durable write lifecycle record. Poll statusUrl until terminal is true. Reusing
53
+ * the original Idempotency-Key returns this same record. Submit a new write only
54
+ * when safeToRetry is true, using a new key.
55
+ */
50
56
  export interface DmSendResponse {
51
- messageId: string;
52
- success: true;
57
+ id: string;
58
+ /**
59
+ * Connected account selected for the write.
60
+ */
61
+ account: DmSendResponse.Account | null;
62
+ action: 'create_tweet' | 'delete_tweet' | 'like' | 'unlike' | 'retweet' | 'unretweet' | 'follow' | 'unfollow' | 'remove_follower' | 'send_dm' | 'upload_media' | 'update_profile' | 'update_avatar' | 'update_banner' | 'create_community' | 'delete_community' | 'join_community' | 'leave_community';
63
+ /**
64
+ * plannedCredits is the approved maximum. chargedCredits comes from the settled
65
+ * credit ledger. Pending or failed writes are not charged.
66
+ */
67
+ billing: DmSendResponse.Billing;
68
+ charged: boolean;
69
+ chargedCredits: string;
70
+ /**
71
+ * Exact follow-up an API client or agent should perform.
72
+ */
73
+ nextAction: DmSendResponse.NextAction | null;
74
+ object: 'x_write_action';
75
+ pollAfterMs: number | null;
76
+ /**
77
+ * Stable fingerprint and sanitized payload for replay checks.
78
+ */
79
+ request: DmSendResponse.Request;
80
+ /**
81
+ * Confirmed result produced by the write, when available.
82
+ */
83
+ result: DmSendResponse.Result | null;
84
+ /**
85
+ * True only when a new attempt can reasonably succeed.
86
+ */
87
+ retryable: boolean;
88
+ /**
89
+ * True only when no write was dispatched and a new idempotency key may be used.
90
+ */
91
+ safeToRetry: boolean;
92
+ sendDispatched: boolean;
93
+ status: 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired';
94
+ statusUrl: string;
95
+ success: boolean;
96
+ /**
97
+ * Existing X resource targeted by the write, when applicable.
98
+ */
99
+ target: DmSendResponse.Target | null;
100
+ targetId: string | null;
101
+ terminal: boolean;
102
+ writeActionId: string;
103
+ /**
104
+ * Compatibility field for a confirmed community ID.
105
+ */
106
+ communityId?: string;
107
+ /**
108
+ * Confirmed community name when available.
109
+ */
110
+ communityName?: string;
111
+ completedAt?: string;
112
+ confirmationAttempts?: number;
113
+ confirmationCheckedAt?: string;
114
+ confirmedAt?: string;
115
+ createdAt?: string;
116
+ /**
117
+ * Structured recovery context for a failed write.
118
+ */
119
+ details?: {
120
+ [key: string]: unknown;
121
+ };
122
+ error?: string;
123
+ /**
124
+ * Deadline for resolving a non-terminal write. This is not the Idempotency-Key
125
+ * retention deadline.
126
+ */
127
+ expiresAt?: string;
128
+ idempotent?: boolean;
129
+ /**
130
+ * Media count, kind, size, and billing details when used.
131
+ */
132
+ media?: {
133
+ [key: string]: unknown;
134
+ };
135
+ /**
136
+ * Compatibility field for a confirmed media upload ID.
137
+ */
138
+ mediaId?: string;
139
+ /**
140
+ * Public media URL when the upload creates one.
141
+ */
142
+ mediaUrl?: string;
143
+ message?: string;
144
+ /**
145
+ * Compatibility field for a confirmed direct message ID.
146
+ */
147
+ messageId?: string;
148
+ requestHash?: string;
149
+ requestId?: string;
150
+ /**
151
+ * Compatibility result ID for other write actions.
152
+ */
153
+ resultId?: string;
154
+ /**
155
+ * Dispatch timestamp when the write reached execution.
156
+ */
157
+ sendDispatchedAt?: string;
158
+ /**
159
+ * Compatibility field for a confirmed tweet result ID.
160
+ */
161
+ tweetId?: string;
162
+ updatedAt?: string;
163
+ }
164
+ export declare namespace DmSendResponse {
165
+ /**
166
+ * Connected account selected for the write.
167
+ */
168
+ interface Account {
169
+ id: string;
170
+ username: string;
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
+ interface Billing {
177
+ charged: boolean;
178
+ chargedCredits: string;
179
+ plannedCredits: string;
180
+ status: 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded';
181
+ }
182
+ /**
183
+ * Exact follow-up an API client or agent should perform.
184
+ */
185
+ interface NextAction {
186
+ type: 'poll' | 'retry' | 'verify_result' | 'fix_request';
187
+ afterMs?: number;
188
+ requiresNewIdempotencyKey?: boolean;
189
+ url?: string;
190
+ }
191
+ /**
192
+ * Stable fingerprint and sanitized payload for replay checks.
193
+ */
194
+ interface Request {
195
+ /**
196
+ * Stable hash of account, action, target, and payload.
197
+ */
198
+ hash: string | null;
199
+ /**
200
+ * Exact sanitized payload dispatched for this action.
201
+ */
202
+ payload: {
203
+ [key: string]: unknown;
204
+ } | null;
205
+ }
206
+ /**
207
+ * Confirmed result produced by the write, when available.
208
+ */
209
+ interface Result {
210
+ id?: string;
211
+ state?: string;
212
+ type?: 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change';
213
+ }
214
+ /**
215
+ * Existing X resource targeted by the write, when applicable.
216
+ */
217
+ interface Target {
218
+ id: string;
219
+ type: 'tweet' | 'user' | 'community';
220
+ }
53
221
  }
54
222
  export interface DmRetrieveHistoryParams {
55
223
  /**
@@ -68,12 +236,22 @@ export interface DmRetrieveHistoryParams {
68
236
  }
69
237
  export interface DmSendParams {
70
238
  /**
71
- * X account (@username or ID) sending the DM
239
+ * Body param: X account (@username or ID) sending the DM
72
240
  */
73
241
  account: string;
242
+ /**
243
+ * Body param
244
+ */
74
245
  text: string;
75
246
  /**
76
- * Optional array containing exactly 1 uploaded media ID.
247
+ * Header param: Generate one unique value for each intended write. Reuse it only
248
+ * when retrying the exact same account, action, target, and payload. A reused key
249
+ * returns the original action. Reusing it with different input returns 409. Replay
250
+ * protection remains active for at least 90 days.
251
+ */
252
+ 'Idempotency-Key': string;
253
+ /**
254
+ * Body param: Optional array containing exactly 1 uploaded media ID.
77
255
  */
78
256
  media_ids?: Array<string>;
79
257
  }
@@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;IAEb;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,YAAY,IAAI,YAAY,GAClC,CAAC;CACH"}
package/resources/x/dm.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Dm = void 0;
5
5
  const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
6
7
  const path_1 = require("../../internal/utils/path.js");
7
8
  class Dm extends resource_1.APIResource {
8
9
  /**
@@ -27,12 +28,18 @@ class Dm extends resource_1.APIResource {
27
28
  * const response = await client.x.dm.send('userId', {
28
29
  * account: '@elonmusk',
29
30
  * text: 'Example text content',
31
+ * 'Idempotency-Key': 'Idempotency-Key',
30
32
  * media_ids: ['1234567890123456789'],
31
33
  * });
32
34
  * ```
33
35
  */
34
- send(userID, body, options) {
35
- return this._client.post((0, path_1.path) `/x/dm/${userID}`, { body, ...options });
36
+ send(userID, params, options) {
37
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
38
+ return this._client.post((0, path_1.path) `/x/dm/${userID}`, {
39
+ body,
40
+ ...options,
41
+ headers: (0, headers_1.buildHeaders)([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
42
+ });
36
43
  }
37
44
  }
38
45
  exports.Dm = Dm;
@@ -1 +1 @@
1
- {"version":3,"file":"dm.js","sourceRoot":"","sources":["../../src/resources/x/dm.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAiD;AAEjD,MAAa,EAAG,SAAQ,sBAAW;IACjC;;;;;;;;;;OAUG;IACH,eA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IACL,CAAC;CACF;AAzCD,gBAyCC"}
@@ -1,5 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
3
4
  import { path } from "../../internal/utils/path.mjs";
4
5
  export class Dm extends APIResource {
5
6
  /**
@@ -24,12 +25,18 @@ export class Dm extends APIResource {
24
25
  * const response = await client.x.dm.send('userId', {
25
26
  * account: '@elonmusk',
26
27
  * text: 'Example text content',
28
+ * 'Idempotency-Key': 'Idempotency-Key',
27
29
  * media_ids: ['1234567890123456789'],
28
30
  * });
29
31
  * ```
30
32
  */
31
- send(userID, body, options) {
32
- return this._client.post(path `/x/dm/${userID}`, { body, ...options });
33
+ send(userID, params, options) {
34
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
35
+ return this._client.post(path `/x/dm/${userID}`, {
36
+ body,
37
+ ...options,
38
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
39
+ });
33
40
  }
34
41
  }
35
42
  //# sourceMappingURL=dm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dm.mjs","sourceRoot":"","sources":["../../src/resources/x/dm.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,EAAG,SAAQ,WAAW;IACjC;;;;;;;;;;OAUG;IACH,eAAe,CACb,MAAc,EACd,KAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,SAAS,MAAM,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAc,EAAE,IAAkB,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO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