import Foundation /// Configuration for a timeline fetch. public struct TimelineOptions: Sendable { /// URL of the relay server. /// Used only when `useRelay` is `true`. public var relayURL: URL /// When `true` (default), the timeline is built from all feeds known to the relay /// instead of only the profile's `#+FOLLOW:` list. If the relay is unreachable, /// the client falls back to the local follow list automatically. /// /// Set to `false` to always use only the follows in the local profile. public var useRelay: Bool /// Maximum number of feeds downloaded in parallel. public var maxConcurrentDownloads: Int /// Only include posts newer than this many days. `nil` fetches all posts. public var maxPostAgeDays: Int? /// If non-empty, only posts whose `lang` matches one of these ISO 639-1 /// codes are included. An empty array (default) shows all languages. public var languageFilter: [String] /// When `false` (default), restrict the timeline to feeds listed in `#+FOLLOW:` /// even if `useRelay` is `true`. Set to `true` to aggregate every feed known to /// the relay (busier timeline, good for discovery). public var showAllRelayFeeds: Bool /// Default options: relay enabled, 20 concurrent downloads, 14-day cutoff, /// all languages. public static let `default` = TimelineOptions() public init( relayURL: URL = URL(string: "https://relay.org-social.org")!, useRelay: Bool = true, maxConcurrentDownloads: Int = 20, maxPostAgeDays: Int? = 14, languageFilter: [String] = [], showAllRelayFeeds: Bool = false ) { self.relayURL = relayURL self.useRelay = useRelay self.maxConcurrentDownloads = maxConcurrentDownloads self.maxPostAgeDays = maxPostAgeDays self.languageFilter = languageFilter self.showAllRelayFeeds = showAllRelayFeeds } }