mirror of
https://github.com/jellyfin/jellyfin-sdk-swift.git
synced 2024-11-30 09:50:25 +00:00
35 lines
1.4 KiB
Swift
35 lines
1.4 KiB
Swift
//
|
|
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
|
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
//
|
|
// Copyright (c) 2022 Jellyfin & Jellyfin Contributors
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// The notification summary DTO.
|
|
public struct NotificationsSummaryDto: Codable {
|
|
/// Gets or sets the maximum unread notification level.
|
|
public var maxUnreadNotificationLevel: NotificationLevel?
|
|
/// Gets or sets the number of unread notifications.
|
|
public var unreadCount: Int32?
|
|
|
|
public init(maxUnreadNotificationLevel: NotificationLevel? = nil, unreadCount: Int32? = nil) {
|
|
self.maxUnreadNotificationLevel = maxUnreadNotificationLevel
|
|
self.unreadCount = unreadCount
|
|
}
|
|
|
|
public init(from decoder: Decoder) throws {
|
|
let values = try decoder.container(keyedBy: StringCodingKey.self)
|
|
self.maxUnreadNotificationLevel = try values.decodeIfPresent(NotificationLevel.self, forKey: "MaxUnreadNotificationLevel")
|
|
self.unreadCount = try values.decodeIfPresent(Int32.self, forKey: "UnreadCount")
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var values = encoder.container(keyedBy: StringCodingKey.self)
|
|
try values.encodeIfPresent(maxUnreadNotificationLevel, forKey: "MaxUnreadNotificationLevel")
|
|
try values.encodeIfPresent(unreadCount, forKey: "UnreadCount")
|
|
}
|
|
}
|