2018-09-11 14:52:21 +00:00
|
|
|
//
|
|
|
|
// Instance.swift
|
|
|
|
// Pachyderm
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 9/9/18.
|
|
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2018-09-17 23:22:37 +00:00
|
|
|
public class Instance: Decodable {
|
2018-09-11 14:52:21 +00:00
|
|
|
public let uri: String
|
|
|
|
public let title: String
|
|
|
|
public let description: String
|
|
|
|
public let email: String
|
|
|
|
public let version: String
|
|
|
|
public let urls: [String: URL]
|
|
|
|
public let languages: [String]
|
|
|
|
public let contactAccount: Account
|
|
|
|
|
|
|
|
// MARK: Unofficial additions to the Mastodon API.
|
|
|
|
public let stats: Stats?
|
|
|
|
public let thumbnail: URL?
|
|
|
|
public let maxStatusCharacters: Int?
|
|
|
|
|
|
|
|
private enum CodingKeys: String, CodingKey {
|
|
|
|
case uri
|
|
|
|
case title
|
|
|
|
case description
|
|
|
|
case email
|
|
|
|
case version
|
|
|
|
case urls
|
|
|
|
case languages
|
|
|
|
case contactAccount = "contact_account"
|
|
|
|
|
|
|
|
case stats
|
|
|
|
case thumbnail
|
|
|
|
case maxStatusCharacters = "max_toot_chars"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension Instance {
|
|
|
|
public class Stats: Decodable {
|
|
|
|
public let domainCount: Int?
|
|
|
|
public let statusCount: Int?
|
|
|
|
public let userCount: Int?
|
|
|
|
|
|
|
|
private enum CodingKeys: String, CodingKey {
|
|
|
|
case domainCount = "domain_count"
|
|
|
|
case statusCount = "status_count"
|
|
|
|
case userCount = "user_count"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|