@@ -62,6 +62,9 @@ This is a comprehensive guide of all methods available for the Twitter API v2 on
6262 - [ Mute someone] ( #mute-someone )
6363 - [ Unmute someone] ( #unmute-someone )
6464 - [ Get users that are muted by you] ( #get-users-that-are-muted-by-you )
65+ - [ Upload medias] ( #upload-medias )
66+ - [ Upload media] ( #upload-media )
67+ - [ Upload media metadata] ( #upload-media-metadata )
6568 - [ Usage] ( #usage )
6669 - [ Get usage] ( #get-usage )
6770 - [ Lists] ( #lists )
@@ -999,6 +1002,51 @@ for await (const mutedUser of mutedPaginator) {
9991002}
10001003```
10011004
1005+ ## Upload medias
1006+
1007+ ### Upload media
1008+
1009+ ** Method** : ` .uploadMedia() `
1010+
1011+ ** Endpoint** : ` media/upload `
1012+
1013+ ** Right level** : ` Read-write `
1014+
1015+ ** Arguments** :
1016+ - ` media: Buffer ` : Media buffer
1017+ - ` options: MediaV2UploadParams `
1018+ - ` options.media_type ` : EUploadMimeType (the mimetype of the media)
1019+ - ` options.media_category? ` : MediaV2MediaCategory (the category of the media)
1020+ - ` options.chunkSize ` : Chunk size
1021+
1022+ ** Returns** : ` string ` : Media ID
1023+
1024+ ** Example**
1025+ ``` ts
1026+ const mediaId = await client .v2 .uploadMedia (Buffer .from (' imgae.png' ), { media_type: ' image/png' });
1027+ const newTweet = await client .v1 .tweet (' Hello!' , { media_ids: mediaId });
1028+ ```
1029+
1030+ ### Upload media metadata
1031+
1032+ ** Method** : ` .createMediaMetadata() `
1033+
1034+ ** Endpoint** : ` media/metadata `
1035+
1036+ ** Right level** : ` Read-write `
1037+
1038+ ** Arguments** :
1039+ - ` mediaId: string `
1040+ - ` metadata: MediaV2MetadataCreateParams `
1041+ - ` metadata.alt_text ` : ` { text: string } ` the alt text of the media
1042+
1043+ ** Returns** : ` MediaV2MetadataCreateResult `
1044+
1045+ ** Example**
1046+ ``` ts
1047+ await client .v2 .createMediaMetadata (mediaId , { alt_text: { text: ' Hello, world!' } });
1048+ ```
1049+
10021050### Get usage
10031051
10041052** Method** : ` .usage() `
0 commit comments