forked from shadowfacts/Tusker
39 lines
830 B
Swift
39 lines
830 B
Swift
//
|
|
// Hashtag.swift
|
|
// Pachyderm
|
|
//
|
|
// Created by Shadowfacts on 9/9/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public class Hashtag: Codable {
|
|
public let name: String
|
|
public let url: URL
|
|
/// Only present when returned from the trending hashtags endpoint
|
|
public let history: [History]?
|
|
|
|
public init(name: String, url: URL) {
|
|
self.name = name
|
|
self.url = url
|
|
self.history = nil
|
|
}
|
|
|
|
private enum CodingKeys: String, CodingKey {
|
|
case name
|
|
case url
|
|
case history
|
|
}
|
|
}
|
|
|
|
extension Hashtag: Equatable, Hashable {
|
|
public static func ==(lhs: Hashtag, rhs: Hashtag) -> Bool {
|
|
return lhs.name == rhs.name
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(url)
|
|
}
|
|
}
|