From 2a84275288932992046d73927fd2eea50a12fb11 Mon Sep 17 00:00:00 2001 From: jk234ert Date: Thu, 18 Feb 2021 23:17:28 +0800 Subject: [PATCH] fix: source in CredentialQuery --- .../MastodonSDK/API/Mastodon+API+Account.swift | 16 ++++------------ .../Sources/MastodonSDK/Protocol/Query.swift | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Account.swift b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Account.swift index f7bec595..31e32308 100644 --- a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Account.swift +++ b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Account.swift @@ -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 } } diff --git a/MastodonSDK/Sources/MastodonSDK/Protocol/Query.swift b/MastodonSDK/Sources/MastodonSDK/Protocol/Query.swift index e683baa9..5cf88809 100644 --- a/MastodonSDK/Sources/MastodonSDK/Protocol/Query.swift +++ b/MastodonSDK/Sources/MastodonSDK/Protocol/Query.swift @@ -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) }