Tusker/Packages/Pachyderm/Sources/Pachyderm/Model/Mention.swift

34 lines
918 B
Swift

//
// Mention.swift
// Pachyderm
//
// Created by Shadowfacts on 9/9/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import Foundation
import WebURL
public struct Mention: Codable {
public let url: WebURL
public let username: String
public let acct: String
/// The instance-local ID of the user being mentioned.
public let id: String
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.username = try container.decode(String.self, forKey: .username)
self.acct = try container.decode(String.self, forKey: .acct)
self.id = try container.decode(String.self, forKey: .id)
self.url = try container.decode(WebURL.self, forKey: .url)
}
private enum CodingKeys: String, CodingKey {
case url
case username
case acct
case id
}
}