mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Adapt maxTootChars to new API
Use JSON key configuration.statuses.max_characters instead of max_toot_chars
This commit is contained in:
parent
96d2ff3a2b
commit
92ef66febc
2 changed files with 24 additions and 4 deletions
|
@ -36,6 +36,6 @@ private extension Instance {
|
|||
stats: record.stats,
|
||||
thumbnail: record.thumbnail,
|
||||
contactAccount: contactAccount,
|
||||
maxTootChars: record.maxTootChars)
|
||||
configuration: Configuration(statuses: Configuration.Statuses(maxCharacters: record.maxTootChars)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,23 @@ public struct Instance: Codable, Hashable {
|
|||
public let domainCount: Int
|
||||
}
|
||||
|
||||
public struct Configuration: Codable, Hashable {
|
||||
// swiftlint:disable:next nesting
|
||||
public struct Statuses: Codable, Hashable {
|
||||
public let maxCharacters: Int?
|
||||
|
||||
public init(maxCharacters: Int?) {
|
||||
self.maxCharacters = maxCharacters
|
||||
}
|
||||
}
|
||||
|
||||
public let statuses: Statuses?
|
||||
|
||||
public init(statuses: Statuses?) {
|
||||
self.statuses = statuses
|
||||
}
|
||||
}
|
||||
|
||||
public let uri: String
|
||||
public let title: String
|
||||
public let description: String
|
||||
|
@ -27,7 +44,10 @@ public struct Instance: Codable, Hashable {
|
|||
public let stats: Stats
|
||||
public let thumbnail: UnicodeURL?
|
||||
public let contactAccount: Account?
|
||||
public let maxTootChars: Int?
|
||||
public var maxTootChars: Int? {
|
||||
configuration?.statuses?.maxCharacters
|
||||
}
|
||||
public let configuration: Configuration?
|
||||
|
||||
public init(uri: String,
|
||||
title: String,
|
||||
|
@ -39,7 +59,7 @@ public struct Instance: Codable, Hashable {
|
|||
stats: Instance.Stats,
|
||||
thumbnail: UnicodeURL?,
|
||||
contactAccount: Account?,
|
||||
maxTootChars: Int?) {
|
||||
configuration: Configuration?) {
|
||||
self.uri = uri
|
||||
self.title = title
|
||||
self.description = description
|
||||
|
@ -50,7 +70,7 @@ public struct Instance: Codable, Hashable {
|
|||
self.stats = stats
|
||||
self.thumbnail = thumbnail
|
||||
self.contactAccount = contactAccount
|
||||
self.maxTootChars = maxTootChars
|
||||
self.configuration = configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue