mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rename FeedlyFeedResourceId to FeedlyFeedResourceID.
This commit is contained in:
@@ -389,7 +389,7 @@ final class FeedlyAPICaller {
|
||||
|
||||
extension FeedlyAPICaller: FeedlyAddFeedToCollectionService {
|
||||
|
||||
func addFeed(with feedId: FeedlyFeedResourceId, title: String? = nil, toCollectionWith collectionId: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ()) {
|
||||
func addFeed(with feedId: FeedlyFeedResourceID, title: String? = nil, toCollectionWith collectionId: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ()) {
|
||||
guard !isSuspended else {
|
||||
return DispatchQueue.main.async {
|
||||
completion(.failure(TransportError.suspended))
|
||||
|
||||
@@ -352,7 +352,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
|
||||
throw FeedlyAccountDelegateError.unableToRenameFeed(feed.nameForDisplay, name)
|
||||
}
|
||||
|
||||
let feedID = FeedlyFeedResourceId(id: feed.feedID)
|
||||
let feedID = FeedlyFeedResourceID(id: feed.feedID)
|
||||
let editedNameBefore = feed.editedName
|
||||
|
||||
// optimistically set the name
|
||||
@@ -383,7 +383,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
|
||||
return
|
||||
}
|
||||
|
||||
let feedId = FeedlyFeedResourceId(id: feed.feedID)
|
||||
let feedId = FeedlyFeedResourceID(id: feed.feedID)
|
||||
let editedNameBefore = feed.editedName
|
||||
|
||||
// Adding an existing feed updates it.
|
||||
@@ -410,7 +410,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
|
||||
throw FeedlyAccountDelegateError.notLoggedIn
|
||||
}
|
||||
|
||||
let resource = FeedlyFeedResourceId(id: feed.feedID)
|
||||
let resource = FeedlyFeedResourceID(id: feed.feedID)
|
||||
let addExistingFeed = try FeedlyAddExistingFeedOperation(account: account,
|
||||
credentials: credentials,
|
||||
resource: resource,
|
||||
|
||||
@@ -12,7 +12,7 @@ protocol FeedlyResourceProviding {
|
||||
var resource: FeedlyResourceID { get }
|
||||
}
|
||||
|
||||
extension FeedlyFeedResourceId: FeedlyResourceProviding {
|
||||
extension FeedlyFeedResourceID: FeedlyResourceProviding {
|
||||
|
||||
var resource: FeedlyResourceID {
|
||||
return self
|
||||
|
||||
@@ -22,7 +22,7 @@ struct FeedlyFeedParser {
|
||||
}
|
||||
|
||||
var url: String {
|
||||
let resource = FeedlyFeedResourceId(id: feed.id)
|
||||
let resource = FeedlyFeedResourceID(id: feed.id)
|
||||
return resource.url
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ protocol FeedlyResourceID {
|
||||
}
|
||||
|
||||
/// The Feed Resource is documented here: https://developer.feedly.com/cloud/
|
||||
struct FeedlyFeedResourceId: FeedlyResourceID {
|
||||
struct FeedlyFeedResourceID: FeedlyResourceID {
|
||||
let id: String
|
||||
|
||||
/// The location of the kind of resource a concrete type represents.
|
||||
@@ -38,7 +38,7 @@ struct FeedlyFeedResourceId: FeedlyResourceID {
|
||||
}
|
||||
}
|
||||
|
||||
extension FeedlyFeedResourceId {
|
||||
extension FeedlyFeedResourceID {
|
||||
init(url: String) {
|
||||
self.id = "feed/\(url)"
|
||||
}
|
||||
@@ -49,23 +49,23 @@ struct FeedlyCategoryResourceID: FeedlyResourceID {
|
||||
|
||||
enum Global {
|
||||
|
||||
static func uncategorized(for userId: String) -> FeedlyCategoryResourceID {
|
||||
static func uncategorized(for userID: String) -> FeedlyCategoryResourceID {
|
||||
// https://developer.feedly.com/cloud/#global-resource-ids
|
||||
let id = "user/\(userId)/category/global.uncategorized"
|
||||
let id = "user/\(userID)/category/global.uncategorized"
|
||||
return FeedlyCategoryResourceID(id: id)
|
||||
}
|
||||
|
||||
/// All articles from all the feeds the user subscribes to.
|
||||
static func all(for userId: String) -> FeedlyCategoryResourceID {
|
||||
static func all(for userID: String) -> FeedlyCategoryResourceID {
|
||||
// https://developer.feedly.com/cloud/#global-resource-ids
|
||||
let id = "user/\(userId)/category/global.all"
|
||||
let id = "user/\(userID)/category/global.all"
|
||||
return FeedlyCategoryResourceID(id: id)
|
||||
}
|
||||
|
||||
/// All articles from all the feeds the user loves most.
|
||||
static func mustRead(for userId: String) -> FeedlyCategoryResourceID {
|
||||
static func mustRead(for userID: String) -> FeedlyCategoryResourceID {
|
||||
// https://developer.feedly.com/cloud/#global-resource-ids
|
||||
let id = "user/\(userId)/category/global.must"
|
||||
let id = "user/\(userID)/category/global.must"
|
||||
return FeedlyCategoryResourceID(id: id)
|
||||
}
|
||||
}
|
||||
@@ -76,9 +76,9 @@ struct FeedlyTagResourceId: FeedlyResourceID {
|
||||
|
||||
enum Global {
|
||||
|
||||
static func saved(for userId: String) -> FeedlyTagResourceId {
|
||||
static func saved(for userID: String) -> FeedlyTagResourceId {
|
||||
// https://developer.feedly.com/cloud/#global-resource-ids
|
||||
let id = "user/\(userId)/tag/global.saved"
|
||||
let id = "user/\(userID)/tag/global.saved"
|
||||
return FeedlyTagResourceId(id: id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class FeedlyAddExistingFeedOperation: FeedlyOperation, FeedlyOperationDelegate,
|
||||
private let operationQueue = MainThreadOperationQueue()
|
||||
var addCompletionHandler: ((Result<Void, Error>) -> ())?
|
||||
|
||||
init(account: Account, credentials: Credentials, resource: FeedlyFeedResourceId, service: FeedlyAddFeedToCollectionService, container: Container, progress: DownloadProgress, customFeedName: String? = nil) throws {
|
||||
init(account: Account, credentials: Credentials, resource: FeedlyFeedResourceID, service: FeedlyAddFeedToCollectionService, container: Container, progress: DownloadProgress, customFeedName: String? = nil) throws {
|
||||
|
||||
let validator = FeedlyFeedContainerValidator(container: container)
|
||||
let (folder, collectionId) = try validator.getValidContainer()
|
||||
|
||||
@@ -10,7 +10,7 @@ import Foundation
|
||||
import AccountError
|
||||
|
||||
protocol FeedlyAddFeedToCollectionService {
|
||||
func addFeed(with feedId: FeedlyFeedResourceId, title: String?, toCollectionWith collectionId: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ())
|
||||
func addFeed(with feedId: FeedlyFeedResourceID, title: String?, toCollectionWith collectionId: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ())
|
||||
}
|
||||
|
||||
final class FeedlyAddFeedToCollectionOperation: FeedlyOperation, FeedlyFeedsAndFoldersProviding, FeedlyResourceProviding {
|
||||
@@ -20,9 +20,9 @@ final class FeedlyAddFeedToCollectionOperation: FeedlyOperation, FeedlyFeedsAndF
|
||||
let service: FeedlyAddFeedToCollectionService
|
||||
let account: Account
|
||||
let folder: Folder
|
||||
let feedResource: FeedlyFeedResourceId
|
||||
let feedResource: FeedlyFeedResourceID
|
||||
|
||||
init(account: Account, folder: Folder, feedResource: FeedlyFeedResourceId, feedName: String? = nil, collectionId: String, service: FeedlyAddFeedToCollectionService) {
|
||||
init(account: Account, folder: Folder, feedResource: FeedlyFeedResourceID, feedName: String? = nil, collectionId: String, service: FeedlyAddFeedToCollectionService) {
|
||||
self.account = account
|
||||
self.folder = folder
|
||||
self.feedResource = feedResource
|
||||
|
||||
@@ -26,7 +26,7 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
private let addToCollectionService: FeedlyAddFeedToCollectionService
|
||||
private let syncUnreadIdsService: FeedlyGetStreamIDsService
|
||||
private let getStreamContentsService: FeedlyGetStreamContentsService
|
||||
private var feedResourceId: FeedlyFeedResourceId?
|
||||
private var feedResourceId: FeedlyFeedResourceID?
|
||||
var addCompletionHandler: ((Result<Feed, Error>) -> ())?
|
||||
|
||||
init(account: Account, credentials: Credentials, url: String, feedName: String?, searchService: FeedlySearchService, addToCollectionService: FeedlyAddFeedToCollectionService, syncUnreadIdsService: FeedlyGetStreamIDsService, getStreamContentsService: FeedlyGetStreamContentsService, database: SyncDatabase, container: Container, progress: DownloadProgress) throws {
|
||||
@@ -81,7 +81,7 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
return didFinish(with: AccountError.createErrorNotFound)
|
||||
}
|
||||
|
||||
let feedResourceId = FeedlyFeedResourceId(id: first.feedId)
|
||||
let feedResourceId = FeedlyFeedResourceID(id: first.feedId)
|
||||
self.feedResourceId = feedResourceId
|
||||
|
||||
let addRequest = FeedlyAddFeedToCollectionOperation(account: account, folder: folder, feedResource: feedResourceId, feedName: feedName, collectionId: collectionId, service: addToCollectionService)
|
||||
|
||||
Reference in New Issue
Block a user