Skip to content

Commit ff0099a

Browse files
committed
docs: document communities endpoints
1 parent 0335ed6 commit ff0099a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

doc/v2.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ This is a comprehensive guide of all methods available for the Twitter API v2 on
9191
- [Search spaces](#search-spaces)
9292
- [Space buyers](#space-buyers)
9393
- [Space tweets](#space-tweets)
94+
- [Communities](#communities)
95+
- [Community by id](#community-by-id)
96+
- [Search communities](#search-communities)
9497
- [Direct messages (DMs)](#direct-messages-dms)
9598
- [Fetch direct message events (without filter)](#fetch-direct-message-events-without-filter)
9699
- [Fetch direct message events by participant id](#fetch-direct-message-events-by-participant-id)
@@ -1534,6 +1537,52 @@ const { data: tweets } = await client.v2.spaceTweets('space-id')
15341537
// tweets is a TweetV2[]
15351538
```
15361539

1540+
## Communities
1541+
1542+
### Community by id
1543+
1544+
Returns a variety of information about a single Community specified by ID.
1545+
1546+
**Method**: `.community()`
1547+
1548+
**Endpoint**: `communities/:id`
1549+
1550+
**Right level**: `Read-only`
1551+
1552+
**Arguments**:
1553+
- `communityId: string`
1554+
- `options?: CommunityByIDV2Params`
1555+
1556+
**Returns**: `CommunityV2Result`
1557+
1558+
**Example**
1559+
```ts
1560+
const { data: community } = await client.v2.community('12345', {
1561+
expansions: ['creator_id'],
1562+
});
1563+
```
1564+
1565+
### Search communities
1566+
1567+
Search for Communities based on keywords.
1568+
1569+
**Method**: `.searchCommunities()`
1570+
1571+
**Endpoint**: `communities/search`
1572+
1573+
**Right level**: `Read-only`
1574+
1575+
**Arguments**:
1576+
- `query: string`
1577+
- `options?: CommunitySearchV2Params`
1578+
1579+
**Returns**: `CommunitiesV2Result`
1580+
1581+
**Example**
1582+
```ts
1583+
const { data: communities } = await client.v2.searchCommunities('typescript');
1584+
```
1585+
15371586
## Direct messages (DMs)
15381587

15391588
### Fetch direct message events (without filter)

0 commit comments

Comments
 (0)