fix: source in CredentialQuery

This commit is contained in:
jk234ert 2021-02-18 23:17:28 +08:00
parent 9395f689ce
commit 2a84275288
2 changed files with 5 additions and 13 deletions

View File

@ -171,9 +171,7 @@ extension Mastodon.API.Account {
public var avatar: String?
public var header: String?
public var locked: Bool?
public var sourcePrivacy: String?
public var sourceSensitive: Bool?
public var sourceLanguage: String?
public var source: Mastodon.Entity.Source?
public var fieldsAttributes: [Mastodon.Entity.Field]?
enum CodingKeys: String, CodingKey {
@ -185,9 +183,7 @@ extension Mastodon.API.Account {
case avatar
case header
case locked
case sourcePrivacy = "source[privacy]"
case sourceSensitive = "source[sensitive]"
case sourceLanguage = "source[language]"
case source
case fieldsAttributes = "fields_attributes"
}
@ -199,9 +195,7 @@ extension Mastodon.API.Account {
avatar: Mastodon.Entity.MediaAttachment? = nil,
header: Mastodon.Entity.MediaAttachment? = nil,
locked: Bool? = nil,
sourcePrivacy: String? = nil,
sourceSensitive: Bool? = nil,
sourceLanguage: String? = nil,
source: Mastodon.Entity.Source? = nil,
fieldsAttributes: [Mastodon.Entity.Field]? = nil
) {
self.discoverable = discoverable
@ -211,9 +205,7 @@ extension Mastodon.API.Account {
self.avatar = avatar?.base64EncondedString
self.header = header?.base64EncondedString
self.locked = locked
self.sourcePrivacy = sourcePrivacy
self.sourceSensitive = sourceSensitive
self.sourceLanguage = sourceLanguage
self.source = source
self.fieldsAttributes = fieldsAttributes
}
}

View File

@ -16,7 +16,7 @@ protocol RequestQuery {
var method: RequestMethod { get }
}
extension RequestQuery where method: Encodable {
extension RequestQuery where Self: Encodable {
var body: Data? {
return try? Mastodon.API.encoder.encode(self)
}