2018-09-11 14:52:21 +00:00
|
|
|
//
|
|
|
|
// Hashtag.swift
|
|
|
|
// Pachyderm
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 9/9/18.
|
|
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2019-12-20 02:20:29 +00:00
|
|
|
public class Hashtag: Codable {
|
2018-09-11 14:52:21 +00:00
|
|
|
public let name: String
|
|
|
|
public let url: URL
|
2022-04-02 15:36:45 +00:00
|
|
|
/// Only present when returned from the trending hashtags endpoint
|
2018-09-11 14:52:21 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-15 01:24:43 +00:00
|
|
|
extension Hashtag: Equatable, Hashable {
|
|
|
|
public static func ==(lhs: Hashtag, rhs: Hashtag) -> Bool {
|
2019-12-20 02:20:29 +00:00
|
|
|
return lhs.name == rhs.name
|
2019-09-15 01:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
|
|
hasher.combine(url)
|
|
|
|
}
|
|
|
|
}
|