// Copyright © 2023 Mastodon gGmbH. All rights reserved. import Foundation import MastodonSDK import CoreDataStack extension APIService { public func getStatusSource( forStatusID statusID: Mastodon.Entity.Status.ID, authenticationBox: MastodonAuthenticationBox) async throws -> Mastodon.Response.Content { let domain = authenticationBox.domain let authorization = authenticationBox.userAuthorization let response = try await Mastodon.API.Statuses.statusSource( forStatusID: statusID, session: session, domain: domain, authorization: authorization).singleOutput() return response } public func getHistory( forStatusID statusID: Mastodon.Entity.Status.ID, authenticationBox: MastodonAuthenticationBox) async throws -> Mastodon.Response.Content<[Mastodon.Entity.StatusEdit]> { let domain = authenticationBox.domain let authorization = authenticationBox.userAuthorization let response = try await Mastodon.API.Statuses.editHistory( forStatusID: statusID, session: session, domain: domain, authorization: authorization).singleOutput() return response } public func publishStatusEdit( forStatusID statusID: Mastodon.Entity.Status.ID, editStatusQuery: Mastodon.API.Statuses.EditStatusQuery, authenticationBox: MastodonAuthenticationBox) async throws -> Mastodon.Response.Content { let domain = authenticationBox.domain let authorization = authenticationBox.userAuthorization let response = try await Mastodon.API.Statuses.editStatus( forStatusID: statusID, editStatusQuery: editStatusQuery, session: session, domain: domain, authorization: authorization).singleOutput() _ = try await Mastodon.API.Statuses.editHistory( forStatusID: statusID, session: session, domain: domain, authorization: authorization ).singleOutput() return response } }