import Foundation /// Fetches and parses an Org Social user profile from a `social.org` URL. public struct ProfileFetcher: Sendable { private let fetcher: FeedFetcher private let parser: OrgSocialParser public init(session: URLSession = .shared) { self.fetcher = FeedFetcher(session: session) self.parser = OrgSocialParser() } /// Downloads and parses the profile at `url`. /// /// - Parameter url: Public URL of the `social.org` file (or a vfile token URL). /// - Returns: Parsed `OrgSocialProfile` with `feedURL` set to `url`. /// - Throws: `FeedFetcherError` on network or decoding failure. public func fetch(from url: URL, bypassCache: Bool = false) async throws -> OrgSocialProfile { let content = try await fetcher.fetch(from: url, bypassCache: bypassCache) var profile = parser.parse(content) profile.feedURL = url return profile } }