mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-12 09:26:26 +01:00
39 lines
979 B
Swift
39 lines
979 B
Swift
//
|
|
// SingleArticleFetcher.swift
|
|
// Account
|
|
//
|
|
// Created by Maurice Parker on 11/29/19.
|
|
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Articles
|
|
|
|
public struct SingleArticleFetcher: ArticleFetcher {
|
|
|
|
private let account: Account
|
|
private let articleID: String
|
|
|
|
public init(account: Account, articleID: String) {
|
|
self.account = account
|
|
self.articleID = articleID
|
|
}
|
|
|
|
public func fetchArticles() -> Set<Article> {
|
|
return account.fetchArticles(.articleIDs(Set([articleID])))
|
|
}
|
|
|
|
public func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) {
|
|
return account.fetchArticlesAsync(.articleIDs(Set([articleID])), callback)
|
|
}
|
|
|
|
public func fetchUnreadArticles() -> Set<Article> {
|
|
return account.fetchArticles(.articleIDs(Set([articleID])))
|
|
}
|
|
|
|
public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) {
|
|
return account.fetchArticlesAsync(.articleIDs(Set([articleID])), callback)
|
|
}
|
|
|
|
}
|