frenzy-ios/Fervor/Instance.swift

35 lines
1.1 KiB
Swift

//
// Instance.swift
// Fervor
//
// Created by Shadowfacts on 10/29/21.
//
@preconcurrency import Foundation
public struct Instance: Decodable, Sendable {
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"
}
}