Decoding of tags working.

This commit is contained in:
Jeremy Beker 2019-05-30 16:01:56 -04:00
parent fdc0374c4f
commit 46e21f57e8
No known key found for this signature in database
GPG Key ID: CD5EE767A4A34FD0
3 changed files with 16 additions and 6 deletions

View File

@ -181,12 +181,12 @@ final class GoogleReaderCompatibleAPICaller: NSObject {
//let conditionalGet = accountMetadata?.conditionalGetInfo[ConditionalGetKeys.tags]
let request = URLRequest(url: callURL, credentials: credentials)
transport.send(request: request, resultType: [GoogleReaderCompatibleTag].self) { result in
transport.send(request: request, resultType: GoogleReaderCompatibleTagWrapper.self) { result in
switch result {
case .success(let (response, tags)):
case .success(let (response, wrapper)):
self.storeConditionalGet(key: ConditionalGetKeys.tags, headers: response.allHeaderFields)
completion(.success(tags))
completion(.success(wrapper?.tags))
case .failure(let error):
completion(.failure(error))
}

View File

@ -574,6 +574,8 @@ private extension GoogleReaderCompatibleAccountDelegate {
os_log(.debug, log: log, "Syncing folders with %ld tags.", tags.count)
// TODO: filter on folder tag type
// TODO: filter names to get rid of prefixes
let tagNames = tags.map { $0.tagID }
// Delete any folders not at GoogleReaderCompatible

View File

@ -8,14 +8,22 @@
import Foundation
struct GoogleReaderCompatibleTagWrapper: Codable {
let tags: [GoogleReaderCompatibleTag]
enum CodingKeys: String, CodingKey {
case tags = "tags"
}
}
struct GoogleReaderCompatibleTag: Codable {
let tagID: Int
let name: String
let tagID: String
let type: String?
enum CodingKeys: String, CodingKey {
case tagID = "id"
case name = "name"
case type = "type"
}
}