Make various tweaks, mostly formatting and Id -> ID changes, to ReaderAPI.

This commit is contained in:
Brent Simmons 2024-04-06 13:14:03 -07:00
parent 5555ae5adc
commit fbc0c72cd5
8 changed files with 41 additions and 42 deletions

View File

@ -634,11 +634,11 @@ private extension ReaderAPIAccountDelegate {
var taggedFeeds = dict
subscription.categories.forEach({ (category) in
if var taggedFeed = taggedFeeds[category.categoryId] {
if var taggedFeed = taggedFeeds[category.categoryID] {
taggedFeed.append(subscription)
taggedFeeds[category.categoryId] = taggedFeed
taggedFeeds[category.categoryID] = taggedFeed
} else {
taggedFeeds[category.categoryId] = [subscription]
taggedFeeds[category.categoryID] = [subscription]
}
})
@ -820,11 +820,11 @@ private extension ReaderAPIAccountDelegate {
return Set<ParsedItem>()
}
let entriesWithOriginStreamIDs = entries.filter { $0.origin.streamId != nil }
let parsedItems: [ParsedItem] = entries.compactMap { entry in
let parsedItems: [ParsedItem] = entries.map { entry in
let streamID = entry.origin.streamId!
guard let streamID = entry.origin.streamID else {
return nil
}
let authors: Set<ParsedAuthor>? = {
guard let name = entry.author else {

View File

@ -295,7 +295,7 @@ enum CreateReaderAPISubscriptionResult {
guard let subscriptions = try await retrieveSubscriptions() else {
throw AccountError.createErrorNotFound
}
guard let subscription = subscriptions.first(where: { $0.feedID == subResult.streamId }) else {
guard let subscription = subscriptions.first(where: { $0.feedID == subResult.streamID }) else {
throw AccountError.createErrorNotFound
}
@ -466,7 +466,7 @@ enum CreateReaderAPISubscriptionResult {
}
let dateInfo = HTTPDateInfo(urlResponse: response)
let itemIDs = entriesItemRefs.compactMap { $0.itemId }
let itemIDs = entriesItemRefs.compactMap { $0.itemID }
return try await retrieveItemIDs(type: type, url: callURL, dateInfo: dateInfo, itemIDs: itemIDs, continuation: entries?.continuation)
}
@ -503,7 +503,7 @@ enum CreateReaderAPISubscriptionResult {
}
var totalItemIDs = itemIDs
totalItemIDs.append(contentsOf: entriesItemRefs.compactMap { $0.itemId })
totalItemIDs.append(contentsOf: entriesItemRefs.compactMap { $0.itemID })
return try await retrieveItemIDs(type: type, url: callURL, dateInfo: dateInfo, itemIDs: totalItemIDs, continuation: entries?.continuation)
}

View File

@ -100,7 +100,6 @@ public struct ReaderAPIEntry: Codable, Sendable {
return String(idNumber, radix: 10, uppercase: false)
}
}
public struct ReaderAPIArticleSummary: Codable, Sendable {
@ -123,11 +122,11 @@ public struct ReaderAPIAlternateLocation: Codable, Sendable {
public struct ReaderAPIEntryOrigin: Codable, Sendable {
public let streamId: String?
public let streamID: String?
public let title: String?
enum CodingKeys: String, CodingKey {
case streamId = "streamId"
case streamID = "streamId"
case title = "title"
}
}

View File

@ -18,16 +18,16 @@ import FoundationExtras
*/
public struct ReaderAPIQuickAddResult: Codable {
public struct ReaderAPIQuickAddResult: Codable, Sendable {
public let numResults: Int
public let error: String?
public let streamId: String?
public let streamID: String?
enum CodingKeys: String, CodingKey {
case numResults = "numResults"
case error = "error"
case streamId = "streamId"
case streamID = "streamId"
}
}
@ -85,30 +85,31 @@ public struct ReaderAPISubscription: Codable, Sendable {
public struct ReaderAPICategory: Codable, Sendable {
public let categoryId: String
public let categoryID: String
public let categoryLabel: String
enum CodingKeys: String, CodingKey {
case categoryId = "id"
case categoryID = "id"
case categoryLabel = "label"
}
}
struct ReaderAPICreateSubscription: Codable {
let feedURL: String
public struct ReaderAPICreateSubscription: Codable, Sendable {
public let feedURL: String
enum CodingKeys: String, CodingKey {
case feedURL = "feed_url"
}
}
struct ReaderAPISubscriptionChoice: Codable {
let name: String?
let url: String
public struct ReaderAPISubscriptionChoice: Codable, Sendable {
public let name: String?
public let url: String
enum CodingKeys: String, CodingKey {
case name = "title"
case url = "feed_url"
}
}

View File

@ -33,5 +33,4 @@ public struct ReaderAPITag: Codable, Sendable {
}
return String(tagID.suffix(from: range.upperBound))
}
}

View File

@ -8,11 +8,11 @@
import Foundation
struct ReaderAPITagging: Codable {
public struct ReaderAPITagging: Codable, Sendable {
let taggingID: Int
let feedID: Int
let name: String
public let taggingID: Int
public let feedID: Int
public let name: String
enum CodingKeys: String, CodingKey {
case taggingID = "id"
@ -22,11 +22,11 @@ struct ReaderAPITagging: Codable {
}
struct ReaderAPICreateTagging: Codable {
let feedID: Int
let name: String
public struct ReaderAPICreateTagging: Codable, Sendable {
public let feedID: Int
public let name: String
enum CodingKeys: String, CodingKey {
case feedID = "feed_id"
case name = "name"

View File

@ -21,9 +21,9 @@ public struct ReaderAPIReferenceWrapper: Codable, Sendable {
public struct ReaderAPIReference: Codable, Sendable {
public let itemId: String?
public let itemID: String?
enum CodingKeys: String, CodingKey {
case itemId = "id"
case itemID = "id"
}
}

View File

@ -7,7 +7,8 @@
import Foundation
public enum ReaderAPIVariant {
public enum ReaderAPIVariant: Sendable {
case generic
case freshRSS
case inoreader
@ -26,5 +27,4 @@ public enum ReaderAPIVariant {
return ""
}
}
}