NetNewsWire/Account/Sources/Account/SingleArticleFetcher.swift
2024-03-24 23:06:30 -07:00

38 lines
804 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SingleArticleFetcher.swift
// Account
//
// Created by Maurice Parker on 11/29/19.
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
//
import Foundation
import Articles
import ArticlesDatabase
public struct SingleArticleFetcher {
private let account: Account
private let articleID: String
public init(account: Account, articleID: String) {
self.account = account
self.articleID = articleID
}
}
extension SingleArticleFetcher: ArticleFetcher {
public func fetchArticles() async throws -> Set<Article> {
try await account.articles(articleIDs: Set([articleID]))
}
// Doesnt actually fetch unread articles. Fetches whatever articleID it is asked to fetch.
public func fetchUnreadArticles() async throws -> Set<Article> {
try await fetchArticles()
}
}