Vernissage/PixelfedKit/Sources/PixelfedKit/Entities/Tag.swift

37 lines
1012 B
Swift
Raw Normal View History

2023-01-20 16:57:25 +01:00
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
2023-03-28 10:35:38 +02:00
// Licensed under the Apache License 2.0.
2023-01-20 16:57:25 +01:00
//
2023-01-10 08:04:25 +01:00
import Foundation
2023-01-22 13:49:19 +01:00
/// Represents a hashtag used within the content of a status.
2023-01-10 08:04:25 +01:00
public struct Tag: Codable {
2023-01-22 13:49:19 +01:00
/// The value of the hashtag after the # sign.
2023-01-10 08:04:25 +01:00
public let name: String
2023-01-22 13:49:19 +01:00
/// A link to the hashtag on the instance.
2023-03-07 16:45:44 +01:00
public let url: String?
2023-01-22 13:49:19 +01:00
/// Usage statistics for given days (typically the past week).
public let history: [TagHistory]?
/// Whether the current tokens authorized user is following this tag.
public let following: Bool?
}
/// Usage statistics for given days.
public struct TagHistory: Codable {
/// UNIX timestamp on midnight of the given day.
public let day: String
/// The counted usage of the tag within that day.
public let uses: String
/// The total of accounts using the tag within that day (cast from an integer).
2023-01-22 13:49:19 +01:00
public let accounts: String
2023-01-10 08:04:25 +01:00
}