diff --git a/doc/v2.md b/doc/v2.md index 6fc8008..8eb6fc1 100644 --- a/doc/v2.md +++ b/doc/v2.md @@ -91,6 +91,9 @@ This is a comprehensive guide of all methods available for the Twitter API v2 on - [Search spaces](#search-spaces) - [Space buyers](#space-buyers) - [Space tweets](#space-tweets) + - [Communities](#communities) + - [Community by id](#community-by-id) + - [Search communities](#search-communities) - [Direct messages (DMs)](#direct-messages-dms) - [Fetch direct message events (without filter)](#fetch-direct-message-events-without-filter) - [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') // tweets is a TweetV2[] ``` +## Communities + +### Community by id + +Returns a variety of information about a single Community specified by ID. + +**Method**: `.community()` + +**Endpoint**: `communities/:id` + +**Right level**: `Read-only` + +**Arguments**: +- `communityId: string` +- `options?: CommunityByIDV2Params` + +**Returns**: `CommunityV2Result` + +**Example** +```ts +const { data: community } = await client.v2.community('12345', { + expansions: ['creator_id'], +}); +``` + +### Search communities + +Search for Communities based on keywords. + +**Method**: `.searchCommunities()` + +**Endpoint**: `communities/search` + +**Right level**: `Read-only` + +**Arguments**: +- `query: string` +- `options?: CommunitySearchV2Params` + +**Returns**: `CommunitiesV2Result` + +**Example** +```ts +const { data: communities } = await client.v2.searchCommunities('typescript'); +``` + ## Direct messages (DMs) ### Fetch direct message events (without filter)