// One GET to somebody else's lookup service, for an album's Find details // (`AlbumLookup`): MusicBrainz, the iTunes Search API and the artwork // address iTunes answers. Never a Cotton server — every byte to one goes // through the core's signed transport — so this file knows no address: the // lookup hands it each one, with the headers that service asks for. import Foundation public enum LookupFetch { /// One GET out: its body and the status it answered. public typealias Get = @Sendable (URL, [String: String]) async throws -> (body: Data, status: Int) /// The phone's own network, the shared session. public static let live: Get = { url, headers in var request = URLRequest(url: url) for (field, value) in headers { request.setValue(value, forHTTPHeaderField: field) } let (body, response) = try await URLSession.shared.data(for: request) return (body, (response as? HTTPURLResponse)?.statusCode ?? 0) } }