> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CommunitiesClient

> Reference for the CommunitiesClient class in the X API TypeScript SDK. Methods, parameters, and return types for the X API v2 communities endpoints.

Cliente para operaciones de communities

This client provides methods for interacting with the communities endpoints
of the X API. It handles authentication, request formatting, and response
parsing for all communities related operations.

## Constructores

### constructor

• **new CommunitiesClient**(`client`): [`CommunitiesClient`](/xdks/typescript/reference/classes/CommunitiesClient)

Creates a new communities client instance

#### Parámetros

| Nombre   | Tipo                                                  | Descripción                    |
| :------- | :---------------------------------------------------- | :----------------------------- |
| `client` | [`Client`](/xdks/typescript/reference/classes/Client) | The main X API client instance |

#### Devuelve

[`CommunitiesClient`](/xdks/typescript/reference/classes/CommunitiesClient)

#### Definido en

[communities/client.ts:102](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/communities/client.ts#L102)

## Métodos

### search

▸ **search**(`query`, `options`): `Promise`\<`Response`>

Search Communities
Retrieves a list of Communities matching the specified search query.

#### Parámetros

| Nombre    | Tipo                                                          | Descripción                  |
| :-------- | :------------------------------------------------------------ | :--------------------------- |
| `query`   | `string`                                                      | Query to search communities. |
| `options` | `SearchOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                            |

#### Devuelve

`Promise`\<`Response`>

Promise resolving to the API response, or raw Response if requestOptions.raw is true

#### Definido en

[communities/client.ts:147](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/communities/client.ts#L147)

▸ **search**(`query`, `options?`): `Promise`\<[`Get2CommunitiesSearchResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesSearchResponse)>

#### Parámetros

| Nombre     | Tipo            |
| :--------- | :-------------- |
| `query`    | `string`        |
| `options?` | `SearchOptions` |

#### Devuelve

`Promise`\<[`Get2CommunitiesSearchResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesSearchResponse)>

#### Definido en

[communities/client.ts:160](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/communities/client.ts#L160)

***

### getById

▸ **getById**(`id`, `options`): `Promise`\<`Response`>

Get Community by ID
Retrieves details of a specific Community by its ID.

#### Parámetros

| Nombre    | Tipo                                                           | Descripción              |
| :-------- | :------------------------------------------------------------- | :----------------------- |
| `id`      | `string`                                                       | The ID of the Community. |
| `options` | `GetByIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                        |

#### Devuelve

`Promise`\<`Response`>

Promise resolving to the API response, or raw Response if requestOptions.raw is true

#### Definido en

[communities/client.ts:352](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/communities/client.ts#L352)

▸ **getById**(`id`, `options?`): `Promise`\<[`Get2CommunitiesIdResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesIdResponse)>

#### Parámetros

| Nombre     | Tipo             |
| :--------- | :--------------- |
| `id`       | `string`         |
| `options?` | `GetByIdOptions` |

#### Devuelve

`Promise`\<[`Get2CommunitiesIdResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesIdResponse)>

#### Definido en

[communities/client.ts:365](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/communities/client.ts#L365)
