2022-05-13 11:23:35 +02:00
|
|
|
//
|
|
|
|
// UserIdentifier.swift
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by MainasuK on 2022-5-13.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import MastodonSDK
|
|
|
|
|
|
|
|
public protocol UserIdentifier {
|
|
|
|
var domain: String { get }
|
|
|
|
var userID: Mastodon.Entity.Account.ID { get }
|
|
|
|
}
|
|
|
|
|
2023-12-28 13:47:07 +01:00
|
|
|
public extension UserIdentifier {
|
|
|
|
var uniqueUserDomainIdentifier: String {
|
|
|
|
"\(userID)@\(domain)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-13 11:23:35 +02:00
|
|
|
public struct MastodonUserIdentifier: UserIdentifier {
|
|
|
|
public let domain: String
|
|
|
|
public var userID: Mastodon.Entity.Account.ID
|
|
|
|
|
|
|
|
|
|
|
|
public init(
|
|
|
|
domain: String,
|
|
|
|
userID: Mastodon.Entity.Account.ID
|
|
|
|
) {
|
|
|
|
self.domain = domain
|
|
|
|
self.userID = userID
|
|
|
|
}
|
|
|
|
}
|