From ba2f1f5f405fc53cb73633a139a95d0a51201284 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Mon, 9 Oct 2023 17:07:22 +0200 Subject: [PATCH] Make extended-description-download work properly (IOS-20) APIService was missing and URL was wrong --- .../MastodonCore/Service/API/APIService+Instance.swift | 4 ++++ .../Sources/MastodonSDK/API/Mastodon+API+Instance.swift | 2 +- .../Entity/Mastodon+Entity+ExtendedDescription.swift | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift index b5a549903..03a63461e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift @@ -24,4 +24,8 @@ extension APIService { ) -> AnyPublisher, Error> { return Mastodon.API.V2.Instance.instance(session: session, domain: domain) } + + public func extendedDescription(domain: String) -> AnyPublisher, Error> { + return Mastodon.API.Instance.extendedDescription(session: session, domain: domain) + } } diff --git a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Instance.swift b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Instance.swift index 33b928da8..871f43632 100644 --- a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Instance.swift +++ b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Instance.swift @@ -51,7 +51,7 @@ extension Mastodon.API.Instance { } static func extendedDescriptionEndpointURL(domain: String) -> URL { - return Mastodon.API.endpointURL(domain: domain).appendingPathComponent("extended_description") + return Mastodon.API.endpointURL(domain: domain).appendingPathComponent("instance").appendingPathComponent("extended_description") } /// Extended description of the server diff --git a/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+ExtendedDescription.swift b/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+ExtendedDescription.swift index 70a85bce5..c42fe6ab1 100644 --- a/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+ExtendedDescription.swift +++ b/MastodonSDK/Sources/MastodonSDK/Entity/Mastodon+Entity+ExtendedDescription.swift @@ -8,8 +8,8 @@ extension Mastodon.Entity { /// ## Reference: /// [Document](https://docs.joinmastodon.org/entities/ExtendedDescription/) public struct ExtendedDescription: Codable { - let updatedAt: Date - let content: String + public let updatedAt: Date + public let content: String enum CodingKeys: String, CodingKey { case updatedAt = "updated_at"