65 lines
1.8 KiB
Swift
65 lines
1.8 KiB
Swift
//
|
|
// APIService+Tags.swift
|
|
//
|
|
//
|
|
// Created by Marcus Kida on 23.11.22.
|
|
//
|
|
|
|
import Foundation
|
|
import Combine
|
|
import MastodonSDK
|
|
|
|
extension APIService {
|
|
|
|
public func getTagInformation(
|
|
for tag: String,
|
|
authenticationBox: MastodonAuthenticationBox
|
|
) async throws -> Mastodon.Response.Content<Mastodon.Entity.Tag> {
|
|
let domain = authenticationBox.domain
|
|
let authorization = authenticationBox.userAuthorization
|
|
|
|
let response = try await Mastodon.API.Tags.getTagInformation(
|
|
session: session,
|
|
domain: domain,
|
|
tagId: tag,
|
|
authorization: authorization
|
|
).singleOutput()
|
|
|
|
return response
|
|
} // end func
|
|
|
|
public func followTag(
|
|
for tag: String,
|
|
authenticationBox: MastodonAuthenticationBox
|
|
) async throws -> Mastodon.Response.Content<Mastodon.Entity.Tag> {
|
|
let domain = authenticationBox.domain
|
|
let authorization = authenticationBox.userAuthorization
|
|
|
|
let response = try await Mastodon.API.Tags.followTag(
|
|
session: session,
|
|
domain: domain,
|
|
tagId: tag,
|
|
authorization: authorization
|
|
).singleOutput()
|
|
|
|
return response
|
|
} // end func
|
|
|
|
public func unfollowTag(
|
|
for tag: String,
|
|
authenticationBox: MastodonAuthenticationBox
|
|
) async throws -> Mastodon.Response.Content<Mastodon.Entity.Tag> {
|
|
let domain = authenticationBox.domain
|
|
let authorization = authenticationBox.userAuthorization
|
|
|
|
let response = try await Mastodon.API.Tags.unfollowTag(
|
|
session: session,
|
|
domain: domain,
|
|
tagId: tag,
|
|
authorization: authorization
|
|
).singleOutput()
|
|
|
|
return response
|
|
} // end func
|
|
}
|