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

# MediaClient

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

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

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

zeUpload]\(/xdks/typescript/reference/classes/MediaClient#finalizeupload)

* [initializeUpload](/xdks/typescript/reference/classes/MediaClient#initializeupload)
* [createSubtitles](/xdks/typescript/reference/classes/MediaClient#createsubtitles)
* [deleteSubtitles](/xdks/typescript/reference/classes/MediaClient#deletesubtitles)

## コンストラクター

### コンストラクター

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

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

#### パラメーター

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

#### 戻り値

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

#### 定義場所

[media/client.ts:250](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L250)

## メソッド

### getByKey

▸ **getByKey**(`mediaKey`, `options`): `Promise`\<`Response`>

Get Media by media key
Retrieves details of a specific Media file by its media key.

#### パラメーター

| 名前         | 型                                                               | 説明                  |
| :--------- | :-------------------------------------------------------------- | :------------------ |
| `mediaKey` | `string`                                                        | A single Media Key. |
| `options`  | `GetByKeyOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                   |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:295](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L295)

▸ **getByKey**(`mediaKey`, `options?`): `Promise`\<[`Get2MediaMediaKeyResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2MediaMediaKeyResponse)>

#### パラメーター

| 名前         | 型                 |
| :--------- | :---------------- |
| `mediaKey` | `string`          |
| `options?` | `GetByKeyOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:308](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L308)

***

### getUploadStatus

▸ **getUploadStatus**(`mediaId`, `options`): `Promise`\<`Response`>

Get Media upload status
Retrieves the status of a Media upload by its ID.

#### パラメーター

| 名前        | 型                                                                      | 説明                                              |
| :-------- | :--------------------------------------------------------------------- | :---------------------------------------------- |
| `mediaId` | `string`                                                               | Media id for the requested media upload status. |
| `options` | `GetUploadStatusOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                                               |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:442](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L442)

▸ **getUploadStatus**(`mediaId`, `options?`): `Promise`\<[`MediaUploadResponse`](/xdks/typescript/reference/interfaces/Schemas.MediaUploadResponse)>

#### パラメーター

| 名前         | 型                        |
| :--------- | :----------------------- |
| `mediaId`  | `string`                 |
| `options?` | `GetUploadStatusOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:455](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L455)

***

### upload

▸ **upload**(`options`): `Promise`\<`Response`>

Upload media
Uploads a media file for use in posts or other content.

#### パラメーター

| 名前        | 型                                                             |
| :-------- | :------------------------------------------------------------ |
| `options` | `UploadOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:582](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L582)

▸ **upload**(`options?`): `Promise`\<[`MediaUploadResponse`](/xdks/typescript/reference/interfaces/Schemas.MediaUploadResponse)>

#### パラメーター

| 名前         | 型               |
| :--------- | :-------------- |
| `options?` | `UploadOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:591](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L591)

***

### getAnalytics

▸ **getAnalytics**(`mediaKeys`, `endTime`, `startTime`, `granularity`, `options`): `Promise`\<`Response`>

Get Media analytics
Retrieves analytics data for media.

#### パラメーター

| 名前            | 型                                                                   | 説明                                                                                |
| :------------ | :------------------------------------------------------------------ | :-------------------------------------------------------------------------------- |
| `mediaKeys`   | `any`\[]                                                            | A comma separated list of Media Keys. Up to 100 are allowed in a single request.  |
| `endTime`     | `string`                                                            | YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.   |
| `startTime`   | `string`                                                            | YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. |
| `granularity` | `string`                                                            | The granularity for the search counts results.                                    |
| `options`     | `GetAnalyticsOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                                                                                 |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:699](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L699)

▸ **getAnalytics**(`mediaKeys`, `endTime`, `startTime`, `granularity`, `options?`): `Promise`\<[`MediaAnalytics`](/xdks/typescript/reference/interfaces/Schemas.MediaAnalytics)>

#### パラメーター

| 名前            | 型                     |
| :------------ | :-------------------- |
| `mediaKeys`   | `any`\[]              |
| `endTime`     | `string`              |
| `startTime`   | `string`              |
| `granularity` | `string`              |
| `options?`    | `GetAnalyticsOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:724](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L724)

***

### appendUpload

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

Append Media upload
Appends data to a Media upload request.

#### パラメーター

| 名前        | 型                                                                   | 説明                                                                  |
| :-------- | :------------------------------------------------------------------ | :------------------------------------------------------------------ |
| `id`      | `string`                                                            | The media identifier for the media to perform the append operation. |
| `options` | `AppendUploadOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                                                                   |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:918](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L918)

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

#### パラメーター

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

#### 戻り値

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

#### 定義場所

[media/client.ts:931](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L931)

***

### getByKeys

▸ **getByKeys**(`mediaKeys`, `options`): `Promise`\<`Response`>

Get Media by media keys
Retrieves details of Media files by their media keys.

#### パラメーター

| 名前          | 型                                                                | 説明                                                                               |
| :---------- | :--------------------------------------------------------------- | :------------------------------------------------------------------------------- |
| `mediaKeys` | `any`\[]                                                         | A comma separated list of Media Keys. Up to 100 are allowed in a single request. |
| `options`   | `GetByKeysOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                                                                                |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1039](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1039)

▸ **getByKeys**(`mediaKeys`, `options?`): `Promise`\<[`Get2MediaResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2MediaResponse)>

#### パラメーター

| 名前          | 型                  |
| :---------- | :----------------- |
| `mediaKeys` | `any`\[]           |
| `options?`  | `GetByKeysOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1052](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1052)

***

### createMetadata

▸ **createMetadata**(`options`): `Promise`\<`Response`>

Create Media metadata
Creates metadata for a Media file.

#### パラメーター

| 名前        | 型                                                                     |
| :-------- | :-------------------------------------------------------------------- |
| `options` | `CreateMetadataOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1191](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1191)

▸ **createMetadata**(`options?`): `Promise`\<[`MetadataCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.MetadataCreateResponse)>

#### パラメーター

| 名前         | 型                       |
| :--------- | :---------------------- |
| `options?` | `CreateMetadataOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1200](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1200)

***

### finalizeUpload

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

Finalize Media upload
Finalizes a Media upload request.

#### パラメーター

| 名前                           | 型        | 説明                                              |
| :--------------------------- | :------- | :---------------------------------------------- |
| `id`                         | `string` | The media id of the targeted media to finalize. |
| `options`                    | `Object` | -                                               |
| `options.requestOptions`     | `Object` | -                                               |
| `options.requestOptions.raw` | `true`   | -                                               |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1296](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1296)

▸ **finalizeUpload**(`id`): `Promise`\<[`MediaUploadResponse`](/xdks/typescript/reference/interfaces/Schemas.MediaUploadResponse)>

#### パラメーター

| 名前   | 型        |
| :--- | :------- |
| `id` | `string` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1309](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1309)

***

### initializeUpload

▸ **initializeUpload**(`options`): `Promise`\<`Response`>

Initialize media upload
Initializes a media upload.

#### パラメーター

| 名前        | 型                                                                       |
| :-------- | :---------------------------------------------------------------------- |
| `options` | `InitializeUploadOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1396](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1396)

▸ **initializeUpload**(`options?`): `Promise`\<[`MediaUploadResponse`](/xdks/typescript/reference/interfaces/Schemas.MediaUploadResponse)>

#### パラメーター

| 名前         | 型                         |
| :--------- | :------------------------ |
| `options?` | `InitializeUploadOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1405](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1405)

***

### createSubtitles

▸ **createSubtitles**(`options`): `Promise`\<`Response`>

Create Media subtitles
Creates subtitles for a specific Media file.

#### パラメーター

| 名前        | 型                                                                      |
| :-------- | :--------------------------------------------------------------------- |
| `options` | `CreateSubtitlesOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1497](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1497)

▸ **createSubtitles**(`options?`): `Promise`\<[`SubtitlesCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.SubtitlesCreateResponse)>

#### パラメーター

| 名前         | 型                        |
| :--------- | :----------------------- |
| `options?` | `CreateSubtitlesOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1506](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1506)

***

### deleteSubtitles

▸ **deleteSubtitles**(`options`): `Promise`\<`Response`>

Delete Media subtitles
Deletes subtitles for a specific Media file.

#### パラメーター

| 名前        | 型                                                                      |
| :-------- | :--------------------------------------------------------------------- |
| `options` | `DeleteSubtitlesOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

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

#### 定義場所

[media/client.ts:1598](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1598)

▸ **deleteSubtitles**(`options?`): `Promise`\<[`SubtitlesDeleteResponse`](/xdks/typescript/reference/interfaces/Schemas.SubtitlesDeleteResponse)>

#### パラメーター

| 名前         | 型                        |
| :--------- | :----------------------- |
| `options?` | `DeleteSubtitlesOptions` |

#### 戻り値

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

#### 定義場所

[media/client.ts:1607](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/media/client.ts#L1607)
