> ## 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

> X API TypeScript SDK の CommunitiesClient クラスのリファレンス。 X API v2 の communities エンドポイントのメソッド、パラメーター、戻り値の型。

communities 操作向けのクライアント

このクライアントは X API の communities エンドポイントと対話するためのメソッドを提供します。認証、リクエストの整形、communities に関連するすべての操作のレスポンス解析を扱います。

## コンストラクター

### コンストラクター

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

新しい communities クライアントインスタンスを作成します

#### パラメーター

| 名前       | 型                                                     | 説明                      |
| :------- | :---------------------------------------------------- | :---------------------- |
| `client` | [`Client`](/xdks/typescript/reference/classes/Client) | メインの X API クライアントインスタンス |

#### 戻り値

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

#### 定義場所

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

## メソッド

### search

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

Search Communities
次の一覧を取得します: Communities matching the specified search query.

#### パラメーター

| 名前        | 型                                                             | 説明                           |
| :-------- | :------------------------------------------------------------ | :--------------------------- |
| `query`   | `string`                                                      | Query to search communities. |
| `options` | `SearchOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                            |

#### 戻り値

`Promise`\<`Response`>

API レスポンスに解決される Promise。requestOptions.raw が true の場合は生の Response を返します

#### 定義場所

[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)>

#### パラメーター

| 名前         | 型               |
| :--------- | :-------------- |
| `query`    | `string`        |
| `options?` | `SearchOptions` |

#### 戻り値

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

#### 定義場所

[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.

#### パラメーター

| 名前        | 型                                                              | 説明                       |
| :-------- | :------------------------------------------------------------- | :----------------------- |
| `id`      | `string`                                                       | The ID of the Community. |
| `options` | `GetByIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                        |

#### 戻り値

`Promise`\<`Response`>

API レスポンスに解決される Promise。requestOptions.raw が true の場合は生の Response を返します

#### 定義場所

[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)>

#### パラメーター

| 名前         | 型                |
| :--------- | :--------------- |
| `id`       | `string`         |
| `options?` | `GetByIdOptions` |

#### 戻り値

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

#### 定義場所

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