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.
Client for media operations
This client provides methods for interacting with the media endpoints
of the X API. It handles authentication, request formatting, and response
parsing for all media related operations.
zeUpload](/xdks/typescript/reference/classes/MediaClient#finalizeupload)
Constructors
constructor
• new MediaClient(client): MediaClient
Creates a new media client instance
Parameters
| Name | Type | Description |
|---|
client | Client | The main X API client instance |
Returns
MediaClient
Defined in
media/client.ts:250
Methods
getByKey
▸ getByKey(mediaKey, options): Promise<Response>
Get Media by media key
Retrieves details of a specific Media file by its media key.
Parameters
| Name | Type | Description |
|---|
mediaKey | string | A single Media Key. |
options | GetByKeyOptions & { requestOptions: { raw: true } } | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:295
▸ getByKey(mediaKey, options?): Promise<Get2MediaMediaKeyResponse>
Parameters
| Name | Type |
|---|
mediaKey | string |
options? | GetByKeyOptions |
Returns
Promise<Get2MediaMediaKeyResponse>
Defined in
media/client.ts:308
getUploadStatus
▸ getUploadStatus(mediaId, options): Promise<Response>
Get Media upload status
Retrieves the status of a Media upload by its ID.
Parameters
| Name | Type | Description |
|---|
mediaId | string | Media id for the requested media upload status. |
options | GetUploadStatusOptions & { requestOptions: { raw: true } } | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:442
▸ getUploadStatus(mediaId, options?): Promise<MediaUploadResponse>
Parameters
| Name | Type |
|---|
mediaId | string |
options? | GetUploadStatusOptions |
Returns
Promise<MediaUploadResponse>
Defined in
media/client.ts:455
upload
▸ upload(options): Promise<Response>
Upload media
Uploads a media file for use in posts or other content.
Parameters
| Name | Type |
|---|
options | UploadOptions & { requestOptions: { raw: true } } |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:582
▸ upload(options?): Promise<MediaUploadResponse>
Parameters
| Name | Type |
|---|
options? | UploadOptions |
Returns
Promise<MediaUploadResponse>
Defined in
media/client.ts:591
getAnalytics
▸ getAnalytics(mediaKeys, endTime, startTime, granularity, options): Promise<Response>
Get Media analytics
Retrieves analytics data for media.
Parameters
| Name | Type | Description |
|---|
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 } } | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:699
▸ getAnalytics(mediaKeys, endTime, startTime, granularity, options?): Promise<MediaAnalytics>
Parameters
| Name | Type |
|---|
mediaKeys | any[] |
endTime | string |
startTime | string |
granularity | string |
options? | GetAnalyticsOptions |
Returns
Promise<MediaAnalytics>
Defined in
media/client.ts:724
appendUpload
▸ appendUpload(id, options): Promise<Response>
Append Media upload
Appends data to a Media upload request.
Parameters
| Name | Type | Description |
|---|
id | string | The media identifier for the media to perform the append operation. |
options | AppendUploadOptions & { requestOptions: { raw: true } } | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:918
▸ appendUpload(id, options?): Promise<MediaUploadAppendResponse>
Parameters
| Name | Type |
|---|
id | string |
options? | AppendUploadOptions |
Returns
Promise<MediaUploadAppendResponse>
Defined in
media/client.ts:931
getByKeys
▸ getByKeys(mediaKeys, options): Promise<Response>
Get Media by media keys
Retrieves details of Media files by their media keys.
Parameters
| Name | Type | Description |
|---|
mediaKeys | any[] | A comma separated list of Media Keys. Up to 100 are allowed in a single request. |
options | GetByKeysOptions & { requestOptions: { raw: true } } | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1039
▸ getByKeys(mediaKeys, options?): Promise<Get2MediaResponse>
Parameters
| Name | Type |
|---|
mediaKeys | any[] |
options? | GetByKeysOptions |
Returns
Promise<Get2MediaResponse>
Defined in
media/client.ts:1052
▸ createMetadata(options): Promise<Response>
Create Media metadata
Creates metadata for a Media file.
Parameters
| Name | Type |
|---|
options | CreateMetadataOptions & { requestOptions: { raw: true } } |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1191
▸ createMetadata(options?): Promise<MetadataCreateResponse>
Parameters
| Name | Type |
|---|
options? | CreateMetadataOptions |
Returns
Promise<MetadataCreateResponse>
Defined in
media/client.ts:1200
finalizeUpload
▸ finalizeUpload(id, options): Promise<Response>
Finalize Media upload
Finalizes a Media upload request.
Parameters
| Name | Type | Description |
|---|
id | string | The media id of the targeted media to finalize. |
options | Object | - |
options.requestOptions | Object | - |
options.requestOptions.raw | true | - |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1296
▸ finalizeUpload(id): Promise<MediaUploadResponse>
Parameters
Returns
Promise<MediaUploadResponse>
Defined in
media/client.ts:1309
initializeUpload
▸ initializeUpload(options): Promise<Response>
Initialize media upload
Initializes a media upload.
Parameters
| Name | Type |
|---|
options | InitializeUploadOptions & { requestOptions: { raw: true } } |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1396
▸ initializeUpload(options?): Promise<MediaUploadResponse>
Parameters
| Name | Type |
|---|
options? | InitializeUploadOptions |
Returns
Promise<MediaUploadResponse>
Defined in
media/client.ts:1405
createSubtitles
▸ createSubtitles(options): Promise<Response>
Create Media subtitles
Creates subtitles for a specific Media file.
Parameters
| Name | Type |
|---|
options | CreateSubtitlesOptions & { requestOptions: { raw: true } } |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1497
▸ createSubtitles(options?): Promise<SubtitlesCreateResponse>
Parameters
| Name | Type |
|---|
options? | CreateSubtitlesOptions |
Returns
Promise<SubtitlesCreateResponse>
Defined in
media/client.ts:1506
deleteSubtitles
▸ deleteSubtitles(options): Promise<Response>
Delete Media subtitles
Deletes subtitles for a specific Media file.
Parameters
| Name | Type |
|---|
options | DeleteSubtitlesOptions & { requestOptions: { raw: true } } |
Returns
Promise<Response>
Promise resolving to the API response, or raw Response if requestOptions.raw is true
Defined in
media/client.ts:1598
▸ deleteSubtitles(options?): Promise<SubtitlesDeleteResponse>
Parameters
| Name | Type |
|---|
options? | DeleteSubtitlesOptions |
Returns
Promise<SubtitlesDeleteResponse>
Defined in
media/client.ts:1607