Decoding of tags working.
This commit is contained in:
parent
fdc0374c4f
commit
46e21f57e8
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue