28 lines
849 B
Swift
Raw Normal View History

2024-12-13 11:35:30 +00:00
/// Represents a user.
2024-12-22 16:24:48 +00:00
public struct User: Identifiable, Hashable, Sendable {
2024-12-10 18:12:13 +00:00
public let id: Int
2024-12-12 11:24:35 +00:00
2024-12-10 18:12:13 +00:00
public let name: String
2024-12-12 11:24:35 +00:00
/// The number of upvotes from other users.
2024-12-10 18:12:13 +00:00
public let score: Int
2024-12-12 11:24:35 +00:00
/// True if the logged in user is subscribed to devRant++.
2024-12-10 18:12:13 +00:00
public let devRantSupporter: Bool
/// A small avatar for the rant views and comment views.
2024-12-13 11:35:30 +00:00
public let avatarSmall: Avatar
2024-12-10 18:12:13 +00:00
/// A large avatar for the profile view.
2024-12-11 16:00:16 +00:00
public let avatarLarge: Avatar?
2024-12-13 11:35:30 +00:00
public init(id: Int, name: String, score: Int, devRantSupporter: Bool, avatarSmall: User.Avatar, avatarLarge: User.Avatar?) {
2024-12-11 16:00:16 +00:00
self.id = id
self.name = name
self.score = score
self.devRantSupporter = devRantSupporter
2024-12-13 11:35:30 +00:00
self.avatarSmall = avatarSmall
2024-12-11 16:00:16 +00:00
self.avatarLarge = avatarLarge
}
2024-12-10 18:12:13 +00:00
}