mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41: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,
|
stats: record.stats,
|
||||||
thumbnail: record.thumbnail,
|
thumbnail: record.thumbnail,
|
||||||
contactAccount: contactAccount,
|
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 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 uri: String
|
||||||
public let title: String
|
public let title: String
|
||||||
public let description: String
|
public let description: String
|
||||||
|
@ -27,7 +44,10 @@ public struct Instance: Codable, Hashable {
|
||||||
public let stats: Stats
|
public let stats: Stats
|
||||||
public let thumbnail: UnicodeURL?
|
public let thumbnail: UnicodeURL?
|
||||||
public let contactAccount: Account?
|
public let contactAccount: Account?
|
||||||
public let maxTootChars: Int?
|
public var maxTootChars: Int? {
|
||||||
|
configuration?.statuses?.maxCharacters
|
||||||
|
}
|
||||||
|
public let configuration: Configuration?
|
||||||
|
|
||||||
public init(uri: String,
|
public init(uri: String,
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -39,7 +59,7 @@ public struct Instance: Codable, Hashable {
|
||||||
stats: Instance.Stats,
|
stats: Instance.Stats,
|
||||||
thumbnail: UnicodeURL?,
|
thumbnail: UnicodeURL?,
|
||||||
contactAccount: Account?,
|
contactAccount: Account?,
|
||||||
maxTootChars: Int?) {
|
configuration: Configuration?) {
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
self.title = title
|
self.title = title
|
||||||
self.description = description
|
self.description = description
|
||||||
|
@ -50,7 +70,7 @@ public struct Instance: Codable, Hashable {
|
||||||
self.stats = stats
|
self.stats = stats
|
||||||
self.thumbnail = thumbnail
|
self.thumbnail = thumbnail
|
||||||
self.contactAccount = contactAccount
|
self.contactAccount = contactAccount
|
||||||
self.maxTootChars = maxTootChars
|
self.configuration = configuration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue