@@ -2,6 +2,10 @@ import Foundation
2
2
3
3
/// A Transmission torrent.
4
4
public struct Torrent : Equatable {
5
+ /// The number of bytes of partial pieces.
6
+ public var bytesUnchecked : Int64 ?
7
+ /// The number of bytes of checksum verified data.
8
+ public var bytesValid : Int64 ?
5
9
/// The date the torrent was added to the server.
6
10
public var dateAdded : Date ?
7
11
/// The file path where the torrent data is being downloaded to.
@@ -37,6 +41,8 @@ public struct Torrent: Equatable {
37
41
38
42
/// Initializes a torrent.
39
43
public init (
44
+ bytesUnchecked: Int64 ? = nil ,
45
+ bytesValid: Int64 ? = nil ,
40
46
dateAdded: Date ? = nil ,
41
47
downloadPath: String ? = nil ,
42
48
downloadRate: Int64 ? = nil ,
@@ -54,6 +60,8 @@ public struct Torrent: Equatable {
54
60
uploaded: Int64 ? = nil ,
55
61
uploadRate: Int64 ? = nil
56
62
) {
63
+ self . bytesUnchecked = bytesUnchecked
64
+ self . bytesValid = bytesValid
57
65
self . dateAdded = dateAdded
58
66
self . downloadPath = downloadPath
59
67
self . downloadRate = downloadRate
@@ -98,6 +106,10 @@ public extension Torrent {
98
106
public extension Torrent {
99
107
/// The keys used to request torrent properties.
100
108
enum PropertyKeys : String , CaseIterable {
109
+ /// Requests the key `haveUnchecked` from the API.
110
+ case bytesUnchecked = " haveUnchecked "
111
+ /// Requests the key `haveValid` from the API.
112
+ case bytesValid = " haveValid "
101
113
/// Requests the key `addedDate` from the API.
102
114
case dateAdded = " addedDate "
103
115
/// Requests the key `downloadDir` from the API.
@@ -141,6 +153,8 @@ extension Torrent {
141
153
dictionary [ propertyKey. rawValue] as? Value
142
154
}
143
155
156
+ bytesUnchecked = decode ( . bytesUnchecked)
157
+ bytesValid = decode ( . bytesValid)
144
158
dateAdded = decode ( . dateAdded) . map ( Date . init ( timeIntervalSince1970: ) )
145
159
downloadPath = decode ( . downloadPath)
146
160
downloadRate = decode ( . downloadRate)
0 commit comments