Skip to content

Commit fee926d

Browse files
authored
docs: clarify reply and quotes (#617)
1 parent f2c594a commit fee926d

File tree

3 files changed

+48
-16
lines changed

3 files changed

+48
-16
lines changed

doc/streaming.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ This lib supports streaming for v1 and v2 API.
1212
* [Search endpoint](#search-endpoint)
1313
* [Search endpoint - Get applied rules](#search-endpoint---get-applied-rules)
1414
* [Search endpoint - Add or delete rules](#search-endpoint---add-or-delete-rules)
15-
* [Sample endpoint](#sample-endpoint-1)
15+
* [Sample endpoint](#sample-endpoint-1)
16+
* [Sample 10% endpoint](#sample-10-endpoint)
1617
* [Make a custom request](#make-a-custom-request)
1718
* [`TweetStream` reference](#tweetstream-reference)
1819
* [Methods / properties](#methods--properties)
@@ -239,6 +240,33 @@ const stream = await client.v2.sampleStream();
239240
// Event data will be tweets of v2 API.
240241
```
241242

243+
### Sample 10% endpoint
244+
245+
Streams approximately 10% of the public tweet volume in real time.
246+
247+
Method: **`v2.sample10Stream()`**.
248+
249+
Endpoint: `tweets/sample10/stream`.
250+
251+
Reference: https://developer.x.com/en/docs/twitter-api/tweets/volume-streams/api-reference/get-tweets-sample10-stream
252+
253+
Level: **Read-only**.
254+
255+
Arguments: `options?: Partial<Tweetv2FieldsParams> & { autoConnect?: boolean }`.
256+
257+
Returns: `TweetStream<TweetV2SingleResult>`.
258+
259+
```ts
260+
const stream = await client.v2.sample10Stream();
261+
for await (const { data } of stream) {
262+
console.log(data.id);
263+
}
264+
// or create a non-auto-connected stream:
265+
const stream = client.v2.sample10Stream({ autoConnect: false });
266+
stream.on(ETwitterStreamEvent.Data, console.log);
267+
await stream.connect({ autoReconnect: true });
268+
```
269+
242270
## Make a custom request
243271

244272
If you know endpoint and parameters (or you don't want them to be parsed),

doc/v2.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This is a comprehensive guide of all methods available for the Twitter API v2 on
4242
- [Get users that retweeted a specific tweet](#get-users-that-retweeted-a-specific-tweet)
4343
- [Retweet a tweet](#retweet-a-tweet)
4444
- [Unretweet a tweet](#unretweet-a-tweet)
45-
- [List quoted replies of a tweet](#list-quoted-replies-of-a-tweet)
45+
- [List quote tweets of a tweet](#list-quote-tweets-of-a-tweet)
4646
- [Bookmarks](#bookmarks)
4747
- [Bookmark a tweet](#bookmark-a-tweet)
4848
- [Remove bookmark](#remove-bookmark)
@@ -268,7 +268,7 @@ console.log('Tweet', createdTweet.id, ':', createdTweet.text);
268268

269269
### Reply to a tweet
270270

271-
Alias to a `.tweet` with `in_reply_to_tweet_id` already set.
271+
Alias to `.tweet()` with `reply: { in_reply_to_tweet_id: tweetId }` already set.
272272

273273
**Method**: `.reply()`
274274

@@ -277,9 +277,9 @@ Alias to a `.tweet` with `in_reply_to_tweet_id` already set.
277277
**Right level**: `Read-write`
278278

279279
**Arguments**:
280-
- `status: string`
281-
- `in_reply_to_status_id: string`
282-
- `payload?: SendTweetV2Params`
280+
- `status: string` – text of the reply.
281+
- `tweetId: string` – ID of the tweet you want to reply to (sets `in_reply_to_tweet_id` in the payload).
282+
- `payload?: SendTweetV2Params` – optional additional parameters (e.g., media, geolocation).
283283

284284
**Returns**: `TweetV2PostTweetResult`
285285

@@ -607,9 +607,9 @@ Remove a retweet of a single tweet.
607607
await client.v2.unretweet('12', '20');
608608
```
609609

610-
### List quoted replies of a tweet
610+
### List quote tweets of a tweet
611611

612-
List quoted replies of a tweets using a tweet paginator.
612+
Retrieve quote tweets for a single tweet using a paginator.
613613

614614
**Method**: `.quotes()`
615615

@@ -618,20 +618,24 @@ List quoted replies of a tweets using a tweet paginator.
618618
**Right level**: `Read-only`
619619

620620
**Arguments**:
621-
- `tweetId: string`: Tweet ID
622-
- `options: TweetV2PaginableTimelineParams`: Tweet meta options
621+
- `tweetId: string` ID of the tweet whose quote tweets you want.
622+
- `options?: TweetV2PaginableTimelineParams` – optional fields/expansions.
623623

624624
**Returns**: `QuotedTweetsTimelineV2Paginator`: A tweet paginator
625625

626626
**Example**
627627
```ts
628-
const quotes = await client.v2.quotes({ expansions: ['author_id'], 'user.fields': ['username', 'url'] })
628+
// Fetch quote tweets for a given tweet ID
629+
const quotes = await client.v2.quotes('1456789', {
630+
expansions: ['author_id'],
631+
'user.fields': ['username', 'url'],
632+
});
629633

630634
for await (const quote of quotes) {
631-
const quotedTweetAuthor = bookmarks.includes.author(quote)
632-
633-
if (quotedTweetAuthor) {
634-
console.log('Quote answer tweet', quote.id, 'has been made by', quotedTweetAuthor.username)
635+
// Access the author using the paginator’s includes helper
636+
const author = quotes.includes.author(quote);
637+
if (author) {
638+
console.log(`${quote.id} quoted by ${author.username}`);
635639
}
636640
}
637641
```

src/v1/client.v1.write.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export default class TwitterApiv1ReadWrite extends TwitterApiv1ReadOnly {
244244
}
245245

246246
/**
247-
* Removes multiple members to a list, by specifying a comma-separated list of member ids or screen names.
247+
* Removes one or more members from a list, by specifying a comma-separated list of member ids or screen names.
248248
* If you add a single `user_id` or `screen_name`, it will target `lists/members/destroy.json`, otherwise
249249
* it will target `lists/members/destroy_all.json`.
250250
* https://developer.x.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all

0 commit comments

Comments
 (0)