feat: add Instance entity

This commit is contained in:
CMK 2021-01-28 11:57:02 +08:00
parent 00fb8eb175
commit d29f473898
1 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,71 @@
//
// Mastodon+Entity+Instance.swift
//
//
// Created by MainasuK Cirno on 2021/1/27.
//
import Foundation
extension Mastodon.Entity {
public struct Instance: Codable {
public let uri: String?
public let title: String?
public let description: String?
public let shortDescription: String?
public let email: String?
public let version: String?
public let languages: [String]? // (ISO 639 Part 1-5 language codes)
public let registrations: Bool?
public let approvalRequired: Bool?
public let invitesEnabled: Bool?
public let urls: [InstanceURL]?
public let statistics: Statistics?
public let thumbnail: String?
public let contactAccount: User?
enum CodingKeys: String, CodingKey {
case uri
case title
case description
case shortDescription = "short_description"
case email
case version
case languages
case registrations
case approvalRequired = "approval_required"
case invitesEnabled
case urls
case statistics
case thumbnail = "thumbnail"
case contactAccount = "contact_account"
}
}
}
extension Mastodon.Entity.Instance {
public struct InstanceURL: Codable {
public let streamingAPI: String
enum CodingKeys: String, CodingKey {
case streamingAPI = "streaming_api"
}
}
}
extension Mastodon.Entity.Instance {
public struct Statistics: Codable {
public let userCount: Int
public let statusCount: Int
public let domainCount: Int
enum CodingKeys: String, CodingKey {
case userCount = "user_count"
case statusCount = "status_count"
case domainCount = "domain_count"
}
}
}