Tweet - daneden/Twift GitHub Wiki

Tweet

public struct Tweet: Codable, Identifiable 

Inheritance

Codable, Expandable, Identifiable, PrivateFielded

Nested Type Aliases

ID

public typealias ID = String

Field

Additional fields that can be requested for this Tweet

public typealias Field = PartialKeyPath<Self>

Properties

id

The unique identifier of the represented Tweet

public let id: ID

text

The actual UTF-8 text of the Tweet.

public let text: String

attachments

Specifies the type of attachments (if any) present in this Tweet

public let attachments: Attachments?

authorId

The unique identifier of the User who posted this Tweet.

public let authorId: User.ID?

conversationId

The Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies)

public let conversationId: Tweet.ID?

createdAt

Creation time of the Tweet

public let createdAt: Date?

entities

Entities which have been parsed out of the text of the Tweet.

public let entities: Entities?

geo

Contains details about the location tagged by the user in this Tweet, if they specified one.

public let geo: Geo?

inReplyToUserId

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?

lang

Language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag.

public let lang: String?

nonPublicMetrics

Non-public engagement metrics for the Tweet at the time of the request. Requires user context authentication.

public let nonPublicMetrics: NonPublicMetrics?

organicMetrics

Engagement metrics, tracked in an organic context, for the Tweet at the time of the request. Requires user context authentication.

public let organicMetrics: OrganicMetrics?

possiblySensitive

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?

promotedMetrics

Engagement metrics, tracked in a promoted context, for the Tweet at the time of the request. Requires user context authentication.

public let promotedMetrics: PromotedMetrics?

publicMetrics

Public engagement metrics for the Tweet at the time of the request.

public let publicMetrics: PublicMetrics?

referencedTweets

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]?

replySettings

Shows you who can reply to a given Tweet.

public let replySettings: ReplyAudience?

source

The name of the app the user Tweeted from.

public let source: String?

withheld

When present, contains withholding details for withheld content.

public let withheld: WithheldInformation?

publicFields

Publicly-available fields

public static var publicFields: Set<Field> = [
    \.attachments,
     \.authorId,
     \.conversationId,
     \.createdAt,
     \.entities,
     \.geo,
     \.inReplyToUserId,
     \.lang,
     \.publicMetrics,
     \.possiblySensitive,
     \.referencedTweets,
     \.replySettings,
     \.source,
     \.withheld
  ]

privateFields

Fields that are only visible to the Tweet author or promoter

public static var privateFields: Set<Field> = [
    \.nonPublicMetrics,
     \.organicMetrics,
     \.promotedMetrics
  ]
⚠️ **GitHub.com Fallback** ⚠️