2020-04-06 21:06:42 -05:00
|
|
|
//
|
|
|
|
// FeedProvider.swift
|
|
|
|
// FeedProvider
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 4/6/20.
|
|
|
|
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import RSCore
|
2020-04-15 16:35:09 -05:00
|
|
|
import RSParser
|
|
|
|
|
|
|
|
public enum FeedProviderAbility {
|
|
|
|
case owner
|
|
|
|
case available
|
|
|
|
case none
|
|
|
|
}
|
2020-04-06 21:06:42 -05:00
|
|
|
|
2020-05-05 17:55:27 -05:00
|
|
|
public struct FeedProviderFeedMetaData {
|
|
|
|
let name: String
|
|
|
|
let homePageURL: String?
|
|
|
|
}
|
|
|
|
|
2020-04-07 15:25:33 -05:00
|
|
|
public protocol FeedProvider {
|
2020-04-06 21:06:42 -05:00
|
|
|
|
2020-04-15 16:35:09 -05:00
|
|
|
/// Informs the caller of the ability for this feed provider to service the given URL
|
2020-04-24 13:33:43 -05:00
|
|
|
func ability(_ urlComponents: URLComponents) -> FeedProviderAbility
|
2020-04-15 16:35:09 -05:00
|
|
|
|
|
|
|
/// Provide the iconURL of the given URL
|
2020-04-16 11:25:39 -05:00
|
|
|
func iconURL(_ urlComponents: URLComponents, completion: @escaping (Result<String, Error>) -> Void)
|
2020-04-15 16:35:09 -05:00
|
|
|
|
2020-05-09 07:33:26 -05:00
|
|
|
/// Construct the associated metadata for the new feed
|
2020-05-05 17:55:27 -05:00
|
|
|
func metaData(_ urlComponents: URLComponents, completion: @escaping (Result<FeedProviderFeedMetaData, Error>) -> Void)
|
2020-04-15 16:35:09 -05:00
|
|
|
|
|
|
|
/// Refresh all the article entries (ParsedItems)
|
2020-04-16 11:25:39 -05:00
|
|
|
func refresh(_ webFeed: WebFeed, completion: @escaping (Result<Set<ParsedItem>, Error>) -> Void)
|
2020-04-15 16:35:09 -05:00
|
|
|
|
2020-04-06 21:06:42 -05:00
|
|
|
}
|