mirror of
https://github.com/jellyfin/jellyfin-sdk-swift.git
synced 2025-03-01 10:16:40 +00:00
35 lines
1.2 KiB
Swift
35 lines
1.2 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
|
|
|
|
/// Defines the MediaBrowser.Model.Dlna.XmlAttribute.
|
|
public struct XmlAttribute: Codable {
|
|
/// Gets or sets the name of the attribute.
|
|
public var name: String?
|
|
/// Gets or sets the value of the attribute.
|
|
public var value: String?
|
|
|
|
public init(name: String? = nil, value: String? = nil) {
|
|
self.name = name
|
|
self.value = value
|
|
}
|
|
|
|
public init(from decoder: Decoder) throws {
|
|
let values = try decoder.container(keyedBy: StringCodingKey.self)
|
|
self.name = try values.decodeIfPresent(String.self, forKey: "Name")
|
|
self.value = try values.decodeIfPresent(String.self, forKey: "Value")
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var values = encoder.container(keyedBy: StringCodingKey.self)
|
|
try values.encodeIfPresent(name, forKey: "Name")
|
|
try values.encodeIfPresent(value, forKey: "Value")
|
|
}
|
|
}
|