51 lines
1.2 KiB
Swift
51 lines
1.2 KiB
Swift
import Foundation
|
|
|
|
struct BookMeta: Identifiable, Codable {
|
|
let id: String
|
|
let title: String
|
|
let author: String
|
|
let type: String
|
|
let last_open: Double? // 支持浮点 Unix 时间戳
|
|
let readtime30d: [Int]?
|
|
let readtime12m: [Int]?
|
|
let readtime_year: Int?
|
|
let is_finished_this_year: Bool?
|
|
}
|
|
|
|
struct AnnotationRow: Identifiable, Codable {
|
|
let id: String // uuid
|
|
let creationdate: String?
|
|
let idref: String?
|
|
let filepos: String?
|
|
let selected: String?
|
|
let note: String?
|
|
init(uuid: String, creationdate: String?, idref: String?, filepos: String?, selected: String?, note: String?) {
|
|
self.id = uuid
|
|
self.creationdate = creationdate
|
|
self.idref = idref
|
|
self.filepos = filepos
|
|
self.selected = selected
|
|
self.note = note
|
|
}
|
|
}
|
|
|
|
struct StatsGlobal: Codable {
|
|
let year_total_minutes: Int
|
|
let month_avg_minutes: Int
|
|
let week_total_minutes: Int
|
|
let day_avg_minutes: Int
|
|
let finished_books_count: Int
|
|
}
|
|
|
|
struct StatsPayload: Codable {
|
|
let generated_at: String?
|
|
let global: StatsGlobal
|
|
}
|
|
|
|
struct BundleIndex {
|
|
let books: [BookMeta]
|
|
let stats: StatsPayload
|
|
let bookIntro: [String:String]
|
|
let annotationsMap: [String:[AnnotationRow]]
|
|
}
|