Media - daneden/Twift GitHub Wiki
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.
public struct Media: Codable, Identifiable
Codable
, Fielded
, Identifiable
public typealias ID = String
Additional fields that can be requested on the Media
object
public typealias Field = PartialKeyPath<Self>
Unique identifier of the expanded media content.
public let mediaKey: ID
A convenience accessor for the mediaKey
property mapped to the more standard id
key path
public var id: ID
Type of media
public let type: MediaType
Available when type is video. Duration in milliseconds of the video.
public let durationMs: Int?
Height of this content in pixels.
public let height: Int?
Non-public engagement metrics for the media content at the time of the request. Requires user context authentication.
public let nonPublicMetrics: Metrics?
Engagement metrics for the media content, tracked in an organic context, at the time of the request. Requires user context authentication.
public let organicMetrics: Metrics?
Engagement metrics for the media content, tracked in a promoted context, at the time of the request. Requires user context authentication.
public let promotedMetrics: Metrics?
Public engagement metrics for the media content at the time of the request.
public let publicMetrics: PublicMetrics?
Width of this content in pixels.
public let width: Int?
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.
public let altText: String?
URL to the static placeholder preview of this content.
public let previewImageUrl: URL?
URL to the media content
public let url: URL?
Each media object may have multiple display or playback variants, with different resolutions or formats
public let variants: [Variant]?