filteredStream(fields_expansions_backfillMinutes_) - daneden/Twift GitHub Wiki

filteredStream(fields:expansions:backfillMinutes:)

Streams Tweets in real-time based on a specific set of filter rules.

public func filteredStream(fields: Set<Tweet.Field> = [],
                             expansions: [Tweet.Expansions] = [],
                             backfillMinutes: Int? = nil
  )

Equivalent to GET /2/tweets/search/stream

Parameters

  • fields: Any additional fields to include on returned objects
  • expansions: Objects and their corresponding fields that should be expanded in the includes property
  • backfillMinutes: By passing this parameter, you can request up to five (5) minutes worth of streaming data that you might have missed during a disconnection to be delivered to you upon reconnection. The backfilled Tweets will automatically flow through the reconnected stream, with older Tweets generally being delivered before any newly matching Tweets. You must include a whole number between 1 and 5 as the value to this parameter. This feature will deliver duplicate Tweets, meaning that if you were disconnected for 90 seconds, and you requested two minutes of backfill, you will receive 30 seconds worth of duplicate Tweets. Due to this, you should make sure your system is tolerant of duplicate data. This feature is currently only available to the Academic Research product track.

Returns

An AsyncSequence of TwitterAPIDataAndIncludes<Tweet, Tweet.Includes> objects.