Skip to content

Commit c9c5cca

Browse files
committed
Update InPlayerItem model to support both v1 and v2 versions of it.
1 parent 6792b8f commit c9c5cca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Source/Core/Models/Asset/InPlayerItem.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public struct InPlayerItem : Codable {
4646
case wowza(asset: WowzaAsset)
4747
case unknown
4848
}
49-
49+
5050
/// Item's ID
5151
public let id : Int?
5252

@@ -58,6 +58,8 @@ public struct InPlayerItem : Codable {
5858

5959
/// Shows whether the asset is active and can be monetized
6060
public let isActive : Bool?
61+
62+
public let active : Bool?
6163

6264
/// The asset’s title
6365
public let title : String?
@@ -93,6 +95,7 @@ public struct InPlayerItem : Codable {
9395
case createdAt = "created_at"
9496
case id = "id"
9597
case isActive = "is_active"
98+
case active = "active"
9699
case itemType = "item_type"
97100
case merchantId = "merchant_id"
98101
case merchantUuid = "merchant_uuid"
@@ -122,6 +125,7 @@ public struct InPlayerItem : Codable {
122125
content = try values.decodeIfPresent(String.self, forKey: .content)
123126
templateId = try values.decodeIfPresent(Int.self, forKey: .templateId)
124127
ageRestriction = try values.decodeIfPresent(InPlayerAgeRestriction.self, forKey: .ageRestriction)
128+
active = try values.decodeIfPresent(Bool.self, forKey: .active)
125129
}
126130

127131
/// Encoder method
@@ -141,6 +145,7 @@ public struct InPlayerItem : Codable {
141145
try values.encodeIfPresent(content, forKey: .content)
142146
try values.encodeIfPresent(templateId, forKey: .templateId)
143147
try values.encodeIfPresent(ageRestriction, forKey: .ageRestriction)
148+
try values.encodeIfPresent(active, forKey: .active)
144149
}
145150

146151
/// Method that return parsed content as enum with associated values

0 commit comments

Comments
 (0)