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

# HttpClient

> X API TypeScript SDK の HttpClient クラスのリファレンス。 Universal HTTP client for Node.js and browsers used to send requests to the X API.

Universal HTTP client that works in both Node.js and browser environments

## コンストラクター

### コンストラクター

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

#### 戻り値

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

#### 定義場所

[http-client.ts:43](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L43)

## メソッド

### createHeaders

▸ **createHeaders**(`init?`): `Headers`

Create a new Headers instance

#### パラメーター

| 名前      | 型                                          |
| :------ | :----------------------------------------- |
| `init?` | `Record`\<`string`, `string`> \| `Headers` |

#### 戻り値

`Headers`

#### 定義場所

[http-client.ts:99](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L99)

***

### request

▸ **request**(`url`, `options?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make an HTTP request

#### パラメーター

| 名前        | 型                                                                                            |
| :-------- | :------------------------------------------------------------------------------------------- |
| `url`     | `string`                                                                                     |
| `options` | [`HttpClientRequestOptions`](/xdks/typescript/reference/interfaces/HttpClientRequestOptions) |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:106](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L106)

***

### get

▸ **get**(`url`, `headers?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make a GET request

#### パラメーター

| 名前         | 型                             |
| :--------- | :---------------------------- |
| `url`      | `string`                      |
| `headers?` | `Record`\<`string`, `string`> |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:141](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L141)

***

### post

▸ **post**(`url`, `body?`, `headers?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make a POST request

#### パラメーター

| 名前         | 型                             |
| :--------- | :---------------------------- |
| `url`      | `string`                      |
| `body?`    | `string`                      |
| `headers?` | `Record`\<`string`, `string`> |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:151](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L151)

***

### put

▸ **put**(`url`, `body?`, `headers?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make a PUT request

#### パラメーター

| 名前         | 型                             |
| :--------- | :---------------------------- |
| `url`      | `string`                      |
| `body?`    | `string`                      |
| `headers?` | `Record`\<`string`, `string`> |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:162](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L162)

***

### delete

▸ **delete**(`url`, `headers?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make a DELETE request

#### パラメーター

| 名前         | 型                             |
| :--------- | :---------------------------- |
| `url`      | `string`                      |
| `headers?` | `Record`\<`string`, `string`> |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:173](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L173)

***

### patch

▸ **patch**(`url`, `body?`, `headers?`): `Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

Make a PATCH request

#### パラメーター

| 名前         | 型                             |
| :--------- | :---------------------------- |
| `url`      | `string`                      |
| `body?`    | `string`                      |
| `headers?` | `Record`\<`string`, `string`> |

#### 戻り値

`Promise`\<[`HttpResponse`](/xdks/typescript/reference/interfaces/HttpResponse)>

#### 定義場所

[http-client.ts:183](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/http-client.ts#L183)
