frenzy-ios/Fervor/Instance.swift

35 lines
1.1 KiB
Swift
Raw Normal View History

2021-12-08 02:58:02 +00:00
//
// Instance.swift
// Fervor
//
// Created by Shadowfacts on 10/29/21.
//
import Foundation
public struct Instance: Decodable {
public let name: String
public let url: URL
public let version: String
public let implementationName: String
public let implementationVersion: String
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.name = try container.decode(String.self, forKey: .name)
self.url = try container.decode(URL.self, forKey: .url)
self.version = try container.decode(String.self, forKey: .version)
self.implementationName = try container.decode(String.self, forKey: .implementationName)
self.implementationVersion = try container.decode(String.self, forKey: .implementationVersion)
}
private enum CodingKeys: String, CodingKey {
case name
case url
case version
case implementationName = "implementation_name"
case implementationVersion = "implementation_version"
}
}