22 lines
612 B
Swift
22 lines
612 B
Swift
|
//
|
||
|
// https://mczachurski.dev
|
||
|
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
||
|
// Licensed under the MIT License.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
import MastodonSwift
|
||
|
|
||
|
extension MastodonClientAuthenticated {
|
||
|
func getAccount(for accountId: String) async throws -> Account {
|
||
|
let request = try Self.request(
|
||
|
for: baseURL,
|
||
|
target: Mastodon.Account.account(accountId),
|
||
|
withBearerToken: token
|
||
|
)
|
||
|
|
||
|
let (data, _) = try await urlSession.data(for: request)
|
||
|
return try JSONDecoder().decode(Account.self, from: data)
|
||
|
}
|
||
|
}
|