mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
903 B
Swift
31 lines
903 B
Swift
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
|
//
|
|
// stringlint:disable
|
|
|
|
import Foundation
|
|
import SessionUtilitiesKit
|
|
|
|
extension SnodeAPI {
|
|
public class GetInfoResponse: SnodeResponse {
|
|
private enum CodingKeys: String, CodingKey {
|
|
case versionString = "version"
|
|
}
|
|
|
|
let versionString: String?
|
|
|
|
var version: Version? { versionString.map { Version.from($0) } }
|
|
|
|
// MARK: - Initialization
|
|
|
|
required init(from decoder: Decoder) throws {
|
|
let container: KeyedDecodingContainer<CodingKeys> = try decoder.container(keyedBy: CodingKeys.self)
|
|
|
|
versionString = (try container.decode([Int]?.self, forKey: .versionString))?
|
|
.map { "\($0)" }
|
|
.joined(separator: ".")
|
|
|
|
try super.init(from: decoder)
|
|
}
|
|
}
|
|
}
|