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
@@ -2,7 +2,9 @@
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';
7
+ import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
6
8
  import { path } from '../../internal/utils/path';
7
9
 
8
10
  /**
@@ -20,8 +22,22 @@ export class Tickets extends APIResource {
20
22
  * });
21
23
  * ```
22
24
  */
23
- create(body: TicketCreateParams, options?: RequestOptions): APIPromise<TicketCreateResponse> {
24
- return this._client.post('/support/tickets', { body, ...options });
25
+ create(params: TicketCreateParams, options?: RequestOptions): APIPromise<TicketCreateResponse> {
26
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
27
+ return this._client.post(
28
+ '/support/tickets',
29
+ maybeMultipartFormRequestOptions(
30
+ {
31
+ body,
32
+ ...options,
33
+ headers: buildHeaders([
34
+ { ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
35
+ options?.headers,
36
+ ]),
37
+ },
38
+ this._client,
39
+ ),
40
+ );
25
41
  }
26
42
 
27
43
  /**
@@ -76,13 +92,40 @@ export class Tickets extends APIResource {
76
92
  * );
77
93
  * ```
78
94
  */
79
- reply(id: string, body: TicketReplyParams, options?: RequestOptions): APIPromise<TicketReplyResponse> {
80
- return this._client.post(path`/support/tickets/${id}/messages`, { body, ...options });
95
+ reply(id: string, params: TicketReplyParams, options?: RequestOptions): APIPromise<TicketReplyResponse> {
96
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
97
+ return this._client.post(
98
+ path`/support/tickets/${id}/messages`,
99
+ maybeMultipartFormRequestOptions(
100
+ {
101
+ body,
102
+ ...options,
103
+ headers: buildHeaders([
104
+ { ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
105
+ options?.headers,
106
+ ]),
107
+ },
108
+ this._client,
109
+ ),
110
+ );
81
111
  }
82
112
  }
83
113
 
84
114
  export interface TicketCreateResponse {
85
- publicId?: string;
115
+ attachments: Array<TicketCreateResponse.Attachment>;
116
+
117
+ publicId: string;
118
+ }
119
+
120
+ export namespace TicketCreateResponse {
121
+ /**
122
+ * Attachment identifier and initial processing state.
123
+ */
124
+ export interface Attachment {
125
+ publicId: string;
126
+
127
+ status: 'pending' | 'ready' | 'failed';
128
+ }
86
129
  }
87
130
 
88
131
  export interface TicketRetrieveResponse {
@@ -101,12 +144,51 @@ export interface TicketRetrieveResponse {
101
144
 
102
145
  export namespace TicketRetrieveResponse {
103
146
  export interface Message {
147
+ attachments?: Array<Message.Attachment>;
148
+
104
149
  body?: string;
105
150
 
106
151
  createdAt?: string;
107
152
 
108
153
  sender?: string;
109
154
  }
155
+
156
+ export namespace Message {
157
+ /**
158
+ * Downloadable image or video attached to a support message.
159
+ */
160
+ export interface Attachment {
161
+ /**
162
+ * Validated media type.
163
+ */
164
+ contentType:
165
+ | 'image/jpeg'
166
+ | 'image/png'
167
+ | 'image/gif'
168
+ | 'image/webp'
169
+ | 'video/mp4'
170
+ | 'video/quicktime'
171
+ | 'video/webm';
172
+
173
+ filename: string;
174
+
175
+ /**
176
+ * Attachment media class.
177
+ */
178
+ kind: 'image' | 'video';
179
+
180
+ publicId: string;
181
+
182
+ sizeBytes: number;
183
+
184
+ /**
185
+ * Storage processing state.
186
+ */
187
+ status: 'pending' | 'ready' | 'failed';
188
+
189
+ url: string;
190
+ }
191
+ }
110
192
  }
111
193
 
112
194
  export interface TicketUpdateResponse {
@@ -136,13 +218,38 @@ export namespace TicketListResponse {
136
218
  }
137
219
 
138
220
  export interface TicketReplyResponse {
139
- publicId?: string;
221
+ attachments: Array<TicketReplyResponse.Attachment>;
222
+
223
+ publicId: string;
224
+ }
225
+
226
+ export namespace TicketReplyResponse {
227
+ /**
228
+ * Attachment identifier and initial processing state.
229
+ */
230
+ export interface Attachment {
231
+ publicId: string;
232
+
233
+ status: 'pending' | 'ready' | 'failed';
234
+ }
140
235
  }
141
236
 
142
237
  export interface TicketCreateParams {
238
+ /**
239
+ * Body param
240
+ */
143
241
  body: string;
144
242
 
243
+ /**
244
+ * Body param
245
+ */
145
246
  subject: string;
247
+
248
+ /**
249
+ * Header param: Generate one random value per ticket or reply. Reuse it only when
250
+ * retrying identical text and attachments. Never log this value.
251
+ */
252
+ 'Idempotency-Key'?: string;
146
253
  }
147
254
 
148
255
  export interface TicketUpdateParams {
@@ -150,7 +257,16 @@ export interface TicketUpdateParams {
150
257
  }
151
258
 
152
259
  export interface TicketReplyParams {
260
+ /**
261
+ * Body param
262
+ */
153
263
  body: string;
264
+
265
+ /**
266
+ * Header param: Generate one random value per ticket or reply. Reuse it only when
267
+ * retrying identical text and attachments. Never log this value.
268
+ */
269
+ 'Idempotency-Key'?: string;
154
270
  }
155
271
 
156
272
  export declare namespace Tickets {
@@ -16,7 +16,7 @@ export class AccountConnectionChallenges extends APIResource {
16
16
  * ```ts
17
17
  * const response =
18
18
  * await client.x.accountConnectionChallenges.submit('id', {
19
- * email_code: '123456',
19
+ * email_code: '<EMAIL_VERIFICATION_CODE>',
20
20
  * });
21
21
  * ```
22
22
  */
@@ -15,9 +15,10 @@ export class Accounts extends APIResource {
15
15
  * @example
16
16
  * ```ts
17
17
  * const account = await client.x.accounts.create({
18
- * email: 'user@example.com',
18
+ * email: 'account@example.invalid',
19
19
  * password: '<ACCOUNT_PASSWORD>',
20
- * username: 'elonmusk',
20
+ * username: 'your_x_username',
21
+ * totp_secret: '<TOTP_SECRET>',
21
22
  * });
22
23
  * ```
23
24
  */
@@ -83,6 +84,7 @@ export class Accounts extends APIResource {
83
84
  * ```ts
84
85
  * const response = await client.x.accounts.reauth('id', {
85
86
  * password: '<ACCOUNT_PASSWORD>',
87
+ * email: 'account@example.invalid',
86
88
  * totp_secret: '<TOTP_SECRET>',
87
89
  * });
88
90
  * ```
@@ -101,10 +103,11 @@ export interface XAccount {
101
103
  createdAt: string;
102
104
 
103
105
  /**
104
- * Derived connection health. `healthy` = ready. `needsReauth` = reconnect the
105
- * account. `locked` = unlock the account on x.com first. `suspended` = X
106
- * suspended the account. `recovering` = retry is available after cooldown.
107
- * `temporaryIssue` = retry shortly.
106
+ * Derived connection health. `healthy` = session active. `needsReauth` = user must
107
+ * submit fresh credentials. `locked` = X locked the account; unlock on x.com
108
+ * first. `suspended` = X banned the account. `recovering` = past cooldown, will
109
+ * auto-retry on next use. `temporaryIssue` = temporary connection problem; retry
110
+ * shortly.
108
111
  */
109
112
  health: 'healthy' | 'locked' | 'needsReauth' | 'recovering' | 'suspended' | 'temporaryIssue';
110
113