Media

data class Media(mediaKey: String?, type: String?)

Media refers to any image, GIF, or video attached to a Tweet. The media object is not a primary object on any endpoint, but can be found and expanded in the Tweet object. The object is available for expansion with ?expansions=attachments.media_keys to get the condensed object with only default fields. Use the expansion with the field parameter: media.fields when requesting additional fields to complete the object.

Constructors

Link copied to clipboard
fun Media(mediaKey: String? = null, type: String? = null)

Types

Link copied to clipboard
class NonPublicMetrics
Link copied to clipboard
class OrganicMetrics
Link copied to clipboard
class PromotedMetrics
Link copied to clipboard
data class PublicMetrics(viewCount: Int)

Properties

Link copied to clipboard
@SerializedName(value = "alt_text")
var altText: String? = null

A description of an image to enable and support accessibility. Can be up to 1000 characters long. Alt text can only be added to images at the moment.

Link copied to clipboard
@SerializedName(value = "duration_ms")
var durationMs: Int? = 0

Available when type is video. Duration in milliseconds of the video.

Link copied to clipboard
@SerializedName(value = "height")
var height: Int? = 0

Height of this content in pixels.

Link copied to clipboard
@SerializedName(value = "media_key")
var mediaKey: String? = null

Unique identifier of the expanded media content.

Link copied to clipboard
@SerializedName(value = "non_public_metrics")
var nonPublicMetrics: Media.NonPublicMetrics? = null

Non-public engagement metrics for the media content at the time of the request.

Link copied to clipboard
@SerializedName(value = "organic_metrics")
var organicMetrics: Media.OrganicMetrics? = null

Engagement metrics for the media content, tracked in an organic context, at the time of the request.

Link copied to clipboard
@SerializedName(value = "preview_image_url")
var previewImageUrl: String? = null

URL to the static placeholder preview of this content.

Link copied to clipboard
@SerializedName(value = "promoted_metrics")
var promotedMetrics: Media.PromotedMetrics? = null

Engagement metrics for the media content, tracked in a promoted context, at the time of the request.

Link copied to clipboard
@SerializedName(value = "public_metrics")
var publicMetrics: Media.PublicMetrics? = null

Public engagement metrics for the media content at the time of the request.

Link copied to clipboard
@SerializedName(value = "type")
var type: String? = null

Type of content (animated_gif, photo, video).

Link copied to clipboard
@SerializedName(value = "width")
var width: Int = 0

Width of this content in pixels.