From db69ddd2090759fa018af550c8e0a61442377d43 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 27 Apr 2024 11:29:10 -0700 Subject: [PATCH] Coalesce the various Feedly services files into one file. --- Feedly/Sources/Feedly/FeedlyServices.swift | 57 +++++++++++++++++++ .../FeedlyGetCollectionsService.swift | 14 ----- .../Services/FeedlyGetEntriesService.swift | 14 ----- .../FeedlyGetStreamContentsService.swift | 14 ----- .../Services/FeedlyGetStreamIDsService.swift | 14 ----- .../Services/FeedlyMarkArticlesService.swift | 37 ------------ 6 files changed, 57 insertions(+), 93 deletions(-) create mode 100644 Feedly/Sources/Feedly/FeedlyServices.swift delete mode 100644 Feedly/Sources/Feedly/Services/FeedlyGetCollectionsService.swift delete mode 100644 Feedly/Sources/Feedly/Services/FeedlyGetEntriesService.swift delete mode 100644 Feedly/Sources/Feedly/Services/FeedlyGetStreamContentsService.swift delete mode 100644 Feedly/Sources/Feedly/Services/FeedlyGetStreamIDsService.swift delete mode 100644 Feedly/Sources/Feedly/Services/FeedlyMarkArticlesService.swift diff --git a/Feedly/Sources/Feedly/FeedlyServices.swift b/Feedly/Sources/Feedly/FeedlyServices.swift new file mode 100644 index 000000000..a133fb1a3 --- /dev/null +++ b/Feedly/Sources/Feedly/FeedlyServices.swift @@ -0,0 +1,57 @@ +// +// 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 -> [FeedlyCollection] +} + +public protocol FeedlyGetEntriesService: AnyObject { + + @MainActor func getEntries(for ids: Set) 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, as action: FeedlyMarkAction) async throws +} diff --git a/Feedly/Sources/Feedly/Services/FeedlyGetCollectionsService.swift b/Feedly/Sources/Feedly/Services/FeedlyGetCollectionsService.swift deleted file mode 100644 index 17d69395b..000000000 --- a/Feedly/Sources/Feedly/Services/FeedlyGetCollectionsService.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyGetCollectionsService.swift -// Account -// -// Created by Kiel Gillard on 21/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -public protocol FeedlyGetCollectionsService: AnyObject { - - @MainActor func getCollections() async throws -> [FeedlyCollection] -} diff --git a/Feedly/Sources/Feedly/Services/FeedlyGetEntriesService.swift b/Feedly/Sources/Feedly/Services/FeedlyGetEntriesService.swift deleted file mode 100644 index 728a0f28d..000000000 --- a/Feedly/Sources/Feedly/Services/FeedlyGetEntriesService.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyGetEntriesService.swift -// Account -// -// Created by Kiel Gillard on 28/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -public protocol FeedlyGetEntriesService: AnyObject { - - @MainActor func getEntries(for ids: Set) async throws -> [FeedlyEntry] -} diff --git a/Feedly/Sources/Feedly/Services/FeedlyGetStreamContentsService.swift b/Feedly/Sources/Feedly/Services/FeedlyGetStreamContentsService.swift deleted file mode 100644 index 4b1260acd..000000000 --- a/Feedly/Sources/Feedly/Services/FeedlyGetStreamContentsService.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyGetStreamContentsService.swift -// Account -// -// Created by Kiel Gillard on 21/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -public protocol FeedlyGetStreamContentsService: AnyObject { - - @MainActor func getStreamContents(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStream -} diff --git a/Feedly/Sources/Feedly/Services/FeedlyGetStreamIDsService.swift b/Feedly/Sources/Feedly/Services/FeedlyGetStreamIDsService.swift deleted file mode 100644 index 889419965..000000000 --- a/Feedly/Sources/Feedly/Services/FeedlyGetStreamIDsService.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyGetStreamIDsService.swift -// Account -// -// Created by Kiel Gillard on 21/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -public protocol FeedlyGetStreamIDsService: AnyObject { - - @MainActor func getStreamIDs(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStreamIDs -} diff --git a/Feedly/Sources/Feedly/Services/FeedlyMarkArticlesService.swift b/Feedly/Sources/Feedly/Services/FeedlyMarkArticlesService.swift deleted file mode 100644 index 146c4a2e1..000000000 --- a/Feedly/Sources/Feedly/Services/FeedlyMarkArticlesService.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// FeedlyMarkArticlesService.swift -// Account -// -// Created by Kiel Gillard on 21/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -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, as action: FeedlyMarkAction) async throws -}