Delete no-longer-used Feedly protocols.

This commit is contained in:
Brent Simmons 2024-04-29 22:09:23 -07:00
parent 8c8cfa6377
commit f87e96dc9e
4 changed files with 28 additions and 103 deletions

View File

@ -362,7 +362,7 @@ func refreshAccessToken(_ refreshRequest: OAuthRefreshAccessTokenRequest) async
}
}
extension FeedlyAPICaller: FeedlyGetCollectionsService {
extension FeedlyAPICaller {
func getCollections() async throws -> Set<FeedlyCollection> {
@ -379,7 +379,7 @@ extension FeedlyAPICaller: FeedlyGetCollectionsService {
}
}
extension FeedlyAPICaller: FeedlyGetStreamContentsService {
extension FeedlyAPICaller {
@MainActor func getStreamContents(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStream {
@ -432,7 +432,7 @@ extension FeedlyAPICaller: FeedlyGetStreamContentsService {
}
}
extension FeedlyAPICaller: FeedlyGetStreamIDsService {
extension FeedlyAPICaller {
@MainActor func getStreamIDs(for resource: FeedlyResourceID, continuation: String? = nil, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStreamIDs {
@ -485,7 +485,7 @@ extension FeedlyAPICaller: FeedlyGetStreamIDsService {
}
}
extension FeedlyAPICaller: FeedlyGetEntriesService {
extension FeedlyAPICaller {
@MainActor func getEntries(for ids: Set<String>) async throws -> [FeedlyEntry] {
@ -505,7 +505,7 @@ extension FeedlyAPICaller: FeedlyGetEntriesService {
}
}
extension FeedlyAPICaller: FeedlyMarkArticlesService {
extension FeedlyAPICaller {
private struct MarkerEntriesBody: Encodable {
let type = "entries"

View File

@ -124,27 +124,6 @@ public struct FeedlyEntry: Decodable, Sendable, Hashable {
}
}
public protocol FeedlyEntryIdentifierProviding: AnyObject {
@MainActor var entryIDs: Set<String> { get }
}
public final class FeedlyEntryIdentifierProvider: FeedlyEntryIdentifierProviding {
private (set) public var entryIDs: Set<String>
public init(entryIDs: Set<String> = Set()) {
self.entryIDs = entryIDs
}
@MainActor public func addEntryIDs(from provider: FeedlyEntryIdentifierProviding) {
entryIDs.formUnion(provider.entryIDs)
}
@MainActor public func addEntryIDs(in articleIDs: [String]) {
entryIDs.formUnion(articleIDs)
}
}
public struct FeedlyEntryParser: Sendable {
public let entry: FeedlyEntry
@ -471,3 +450,26 @@ public struct FeedlyTag: Decodable, Sendable, Equatable {
lhs.id == rhs.id && lhs.label == rhs.label
}
}
public enum FeedlyMarkAction: String, Sendable {
case read
case unread
case saved
case unsaved
/// These values are paired with the "action" key in POST requests to the markers API.
/// See for example: https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read
public var actionValue: String {
switch self {
case .read:
return "markAsRead"
case .unread:
return "keepUnread"
case .saved:
return "markAsSaved"
case .unsaved:
return "markAsUnsaved"
}
}
}

View File

@ -1,20 +0,0 @@
//
// FeedlyResourceProviding.swift
// Account
//
// Created by Kiel Gillard on 11/10/19.
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
//
import Foundation
public protocol FeedlyResourceProviding {
@MainActor var resource: FeedlyResourceID { get }
}
extension FeedlyFeedResourceID: FeedlyResourceProviding {
public var resource: FeedlyResourceID {
return self
}
}

View File

@ -1,57 +0,0 @@
//
// FeedlyServices.swift
//
//
// Created by Brent Simmons on 4/27/24.
// Includes text of a bunch of files created by Kiel Gillard 2019
//
import Foundation
public protocol FeedlyGetCollectionsService: AnyObject {
@MainActor func getCollections() async throws -> Set<FeedlyCollection>
}
public protocol FeedlyGetEntriesService: AnyObject {
@MainActor func getEntries(for ids: Set<String>) async throws -> [FeedlyEntry]
}
public protocol FeedlyGetStreamContentsService: AnyObject {
@MainActor func getStreamContents(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStream
}
public protocol FeedlyGetStreamIDsService: AnyObject {
@MainActor func getStreamIDs(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStreamIDs
}
public enum FeedlyMarkAction: String, Sendable {
case read
case unread
case saved
case unsaved
/// These values are paired with the "action" key in POST requests to the markers API.
/// See for example: https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read
public var actionValue: String {
switch self {
case .read:
return "markAsRead"
case .unread:
return "keepUnread"
case .saved:
return "markAsSaved"
case .unsaved:
return "markAsUnsaved"
}
}
}
public protocol FeedlyMarkArticlesService: AnyObject {
@MainActor func mark(_ articleIDs: Set<String>, as action: FeedlyMarkAction) async throws
}