metatext/DB/Sources/DB/Entities/Profile.swift

28 lines
820 B
Swift
Raw Permalink Normal View History

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
import Mastodon
public struct Profile: Codable, Hashable {
public let account: Account
public let relationship: Relationship?
public let identityProofs: [IdentityProof]
2021-01-18 07:17:45 +00:00
public let featuredTags: [FeaturedTag]
2021-02-08 05:24:06 +00:00
public init(account: Account, relationship: Relationship?) {
self.account = account
2021-02-08 05:24:06 +00:00
self.relationship = relationship
self.identityProofs = []
2021-01-18 07:17:45 +00:00
self.featuredTags = []
}
}
extension Profile {
init(info: ProfileInfo) {
account = Account(info: info.accountInfo)
relationship = info.relationship
identityProofs = info.identityProofRecords.map(IdentityProof.init(record:))
2021-01-18 07:17:45 +00:00
featuredTags = info.featuredTagRecords.map(FeaturedTag.init(record:))
}
}