Tweet - daneden/Twift GitHub Wiki
public struct Tweet: Codable, Identifiable
Codable
, Expandable
, Identifiable
, PrivateFielded
public typealias ID = String
Additional fields that can be requested for this Tweet
public typealias Field = PartialKeyPath<Self>
The unique identifier of the represented Tweet
public let id: ID
The actual UTF-8 text of the Tweet.
public let text: String
Specifies the type of attachments (if any) present in this Tweet
public let attachments: Attachments?
The unique identifier of the User who posted this Tweet.
public let authorId: User.ID?
The Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies)
public let conversationId: Tweet.ID?
Creation time of the Tweet
public let createdAt: Date?
Entities which have been parsed out of the text of the Tweet.
public let entities: Entities?
Contains details about the location tagged by the user in this Tweet, if they specified one.
public let geo: Geo?
If the represented Tweet is a reply, this field will contain the original Tweet’s author ID. This will not necessarily always be the user directly mentioned in the Tweet.
public let inReplyToUserId: User.ID?
Language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag.
public let lang: String?
Non-public engagement metrics for the Tweet at the time of the request. Requires user context authentication.
public let nonPublicMetrics: NonPublicMetrics?
Engagement metrics, tracked in an organic context, for the Tweet at the time of the request. Requires user context authentication.
public let organicMetrics: OrganicMetrics?
This field only surfaces when a Tweet contains a link. The meaning of the field doesn’t pertain to the Tweet content itself, but instead it is an indicator that the URL contained in the Tweet may contain content or media identified as sensitive content.
public let possiblySensitive: Bool?
Engagement metrics, tracked in a promoted context, for the Tweet at the time of the request. Requires user context authentication.
public let promotedMetrics: PromotedMetrics?
Public engagement metrics for the Tweet at the time of the request.
public let publicMetrics: PublicMetrics?
A list of Tweets this Tweet refers to. For example, if the parent Tweet is a Retweet, a Retweet with comment (also known as Quoted Tweet) or a Reply, it will include the related Tweet referenced to by its parent.
public let referencedTweets: [ReferencedTweet]?
Shows you who can reply to a given Tweet.
public let replySettings: ReplyAudience?
The name of the app the user Tweeted from.
public let source: String?
When present, contains withholding details for withheld content.
public let withheld: WithheldInformation?
Publicly-available fields
public static var publicFields: Set<Field> = [
\.attachments,
\.authorId,
\.conversationId,
\.createdAt,
\.entities,
\.geo,
\.inReplyToUserId,
\.lang,
\.publicMetrics,
\.possiblySensitive,
\.referencedTweets,
\.replySettings,
\.source,
\.withheld
]
Fields that are only visible to the Tweet author or promoter
public static var privateFields: Set<Field> = [
\.nonPublicMetrics,
\.organicMetrics,
\.promotedMetrics
]