From 05fe4e190e77fdc28b75b98448cf769f49849cea Mon Sep 17 00:00:00 2001 From: Martin Mitrevski Date: Mon, 11 Nov 2024 15:01:16 +0100 Subject: [PATCH] Generated code for closed captions (#595) --- Sources/StreamVideo/CallState.swift | 6 +++ .../OpenApi/generated/APIs/DefaultAPI.swift | 42 +++++++++++++++++++ .../generated/Models/CallClosedCaption.swift | 9 +++- .../CallClosedCaptionsFailedEvent.swift | 35 ++++++++++++++++ .../CallClosedCaptionsStartedEvent.swift | 35 ++++++++++++++++ .../CallClosedCaptionsStoppedEvent.swift | 35 ++++++++++++++++ .../OpenApi/generated/Models/CallEvent.swift | 24 ++++++++--- .../generated/Models/CallResponse.swift | 6 +++ .../generated/Models/OwnCapability.swift | 2 + .../Models/StartClosedCaptionsResponse.swift | 26 ++++++++++++ .../Models/StopClosedCaptionsResponse.swift | 26 ++++++++++++ .../Models/TranscriptionSettings.swift | 21 +++++++++- .../Models/TranscriptionSettingsRequest.swift | 21 +++++++++- .../generated/Models/UserInfoResponse.swift | 7 +++- .../OpenApi/generated/Models/VideoEvent.swift | 30 +++++++++++++ StreamVideo.xcodeproj/project.pbxproj | 21 +++++++++- .../Mock/MockResponseBuilder.swift | 3 +- .../Utilities/Dummy/CallResponse+Dummy.swift | 1 + .../Dummy/TranscriptionSettings+Dummy.swift | 2 +- 19 files changed, 336 insertions(+), 16 deletions(-) create mode 100644 Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsFailedEvent.swift create mode 100644 Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStartedEvent.swift create mode 100644 Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStoppedEvent.swift create mode 100644 Sources/StreamVideo/OpenApi/generated/Models/StartClosedCaptionsResponse.swift create mode 100644 Sources/StreamVideo/OpenApi/generated/Models/StopClosedCaptionsResponse.swift diff --git a/Sources/StreamVideo/CallState.swift b/Sources/StreamVideo/CallState.swift index 3fc52dea2..ee0602b24 100644 --- a/Sources/StreamVideo/CallState.swift +++ b/Sources/StreamVideo/CallState.swift @@ -254,6 +254,12 @@ public class CallState: ObservableObject { break case .typeUserUpdatedEvent: break + case .typeCallClosedCaptionsFailedEvent: + break + case .typeCallClosedCaptionsStartedEvent: + break + case .typeCallClosedCaptionsStoppedEvent: + break } } diff --git a/Sources/StreamVideo/OpenApi/generated/APIs/DefaultAPI.swift b/Sources/StreamVideo/OpenApi/generated/APIs/DefaultAPI.swift index 87b484c6a..b9730071d 100644 --- a/Sources/StreamVideo/OpenApi/generated/APIs/DefaultAPI.swift +++ b/Sources/StreamVideo/OpenApi/generated/APIs/DefaultAPI.swift @@ -665,6 +665,25 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable { } } + open func startClosedCaptions(type: String, id: String) async throws -> StartClosedCaptionsResponse { + var path = "/video/call/{type}/{id}/start_closed_captions" + + let typePreEscape = "\(APIHelper.mapValueToPathItem(type))" + let typePostEscape = typePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: String(format: "{%@}", "type"), with: typePostEscape, options: .literal, range: nil) + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: String(format: "{%@}", "id"), with: idPostEscape, options: .literal, range: nil) + + let urlRequest = try makeRequest( + uriPath: path, + httpMethod: "POST" + ) + return try await send(request: urlRequest) { + try self.jsonDecoder.decode(StartClosedCaptionsResponse.self, from: $0) + } + } + open func startRecording( type: String, id: String, @@ -759,6 +778,25 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable { } } + open func stopClosedCaptions(type: String, id: String) async throws -> StopClosedCaptionsResponse { + var path = "/video/call/{type}/{id}/stop_closed_captions" + + let typePreEscape = "\(APIHelper.mapValueToPathItem(type))" + let typePostEscape = typePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: String(format: "{%@}", "type"), with: typePostEscape, options: .literal, range: nil) + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: String(format: "{%@}", "id"), with: idPostEscape, options: .literal, range: nil) + + let urlRequest = try makeRequest( + uriPath: path, + httpMethod: "POST" + ) + return try await send(request: urlRequest) { + try self.jsonDecoder.decode(StopClosedCaptionsResponse.self, from: $0) + } + } + open func stopLive(type: String, id: String) async throws -> StopLiveResponse { var path = "/video/call/{type}/{id}/stop_live" @@ -1127,6 +1165,8 @@ protocol DefaultAPIEndpoints { func startHLSBroadcasting(type: String, id: String) async throws -> StartHLSBroadcastingResponse + func startClosedCaptions(type: String, id: String) async throws -> StartClosedCaptionsResponse + func startRecording(type: String, id: String, startRecordingRequest: StartRecordingRequest) async throws -> StartRecordingResponse @@ -1137,6 +1177,8 @@ protocol DefaultAPIEndpoints { func stopHLSBroadcasting(type: String, id: String) async throws -> StopHLSBroadcastingResponse + func stopClosedCaptions(type: String, id: String) async throws -> StopClosedCaptionsResponse + func stopLive(type: String, id: String) async throws -> StopLiveResponse func stopRecording(type: String, id: String) async throws -> StopRecordingResponse diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaption.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaption.swift index b0c20acbe..f95a22cc8 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaption.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaption.swift @@ -10,12 +10,14 @@ public final class CallClosedCaption: @unchecked Sendable, Codable, JSONEncodabl public var speakerId: String public var startTime: Date public var text: String + public var user: UserResponse? - public init(endTime: Date, speakerId: String, startTime: Date, text: String) { + public init(endTime: Date, speakerId: String, startTime: Date, text: String, user: UserResponse? = nil) { self.endTime = endTime self.speakerId = speakerId self.startTime = startTime self.text = text + self.user = user } public enum CodingKeys: String, CodingKey, CaseIterable { @@ -23,13 +25,15 @@ public final class CallClosedCaption: @unchecked Sendable, Codable, JSONEncodabl case speakerId = "speaker_id" case startTime = "start_time" case text + case user } public static func == (lhs: CallClosedCaption, rhs: CallClosedCaption) -> Bool { lhs.endTime == rhs.endTime && lhs.speakerId == rhs.speakerId && lhs.startTime == rhs.startTime && - lhs.text == rhs.text + lhs.text == rhs.text && + lhs.user == rhs.user } public func hash(into hasher: inout Hasher) { @@ -37,5 +41,6 @@ public final class CallClosedCaption: @unchecked Sendable, Codable, JSONEncodabl hasher.combine(speakerId) hasher.combine(startTime) hasher.combine(text) + hasher.combine(user) } } diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsFailedEvent.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsFailedEvent.swift new file mode 100644 index 000000000..d709cd1f9 --- /dev/null +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsFailedEvent.swift @@ -0,0 +1,35 @@ +// +// Copyright © 2024 Stream.io Inc. All rights reserved. +// + +import Foundation + +public final class CallClosedCaptionsFailedEvent: @unchecked Sendable, Event, Codable, JSONEncodable, Hashable, WSCallEvent { + + public var callCid: String + public var createdAt: Date + public var type: String = "call.closed_captions_failed" + + public init(callCid: String, createdAt: Date) { + self.callCid = callCid + self.createdAt = createdAt + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case callCid = "call_cid" + case createdAt = "created_at" + case type + } + + public static func == (lhs: CallClosedCaptionsFailedEvent, rhs: CallClosedCaptionsFailedEvent) -> Bool { + lhs.callCid == rhs.callCid && + lhs.createdAt == rhs.createdAt && + lhs.type == rhs.type + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(callCid) + hasher.combine(createdAt) + hasher.combine(type) + } +} diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStartedEvent.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStartedEvent.swift new file mode 100644 index 000000000..490488932 --- /dev/null +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStartedEvent.swift @@ -0,0 +1,35 @@ +// +// Copyright © 2024 Stream.io Inc. All rights reserved. +// + +import Foundation + +public final class CallClosedCaptionsStartedEvent: @unchecked Sendable, Event, Codable, JSONEncodable, Hashable, WSCallEvent { + + public var callCid: String + public var createdAt: Date + public var type: String = "call.closed_captions_started" + + public init(callCid: String, createdAt: Date) { + self.callCid = callCid + self.createdAt = createdAt + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case callCid = "call_cid" + case createdAt = "created_at" + case type + } + + public static func == (lhs: CallClosedCaptionsStartedEvent, rhs: CallClosedCaptionsStartedEvent) -> Bool { + lhs.callCid == rhs.callCid && + lhs.createdAt == rhs.createdAt && + lhs.type == rhs.type + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(callCid) + hasher.combine(createdAt) + hasher.combine(type) + } +} diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStoppedEvent.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStoppedEvent.swift new file mode 100644 index 000000000..931298f36 --- /dev/null +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallClosedCaptionsStoppedEvent.swift @@ -0,0 +1,35 @@ +// +// Copyright © 2024 Stream.io Inc. All rights reserved. +// + +import Foundation + +public final class CallClosedCaptionsStoppedEvent: @unchecked Sendable, Event, Codable, JSONEncodable, Hashable, WSCallEvent { + + public var callCid: String + public var createdAt: Date + public var type: String = "call.closed_captions_stopped" + + public init(callCid: String, createdAt: Date) { + self.callCid = callCid + self.createdAt = createdAt + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case callCid = "call_cid" + case createdAt = "created_at" + case type + } + + public static func == (lhs: CallClosedCaptionsStoppedEvent, rhs: CallClosedCaptionsStoppedEvent) -> Bool { + lhs.callCid == rhs.callCid && + lhs.createdAt == rhs.createdAt && + lhs.type == rhs.type + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(callCid) + hasher.combine(createdAt) + hasher.combine(type) + } +} diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallEvent.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallEvent.swift index 9a5898763..d2570d207 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/CallEvent.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallEvent.swift @@ -7,29 +7,35 @@ import Foundation public final class CallEvent: @unchecked Sendable, Codable, JSONEncodable, Hashable { public var _internal: Bool - public var additional: [String: RawJSON]? + public var category: String? public var component: String? public var description: String public var endTimestamp: Int + public var issueTags: [String]? + public var kind: String? public var severity: Int public var timestamp: Int public var type: String public init( _internal: Bool, - additional: [String: RawJSON]? = nil, + category: String? = nil, component: String? = nil, description: String, endTimestamp: Int, + issueTags: [String]? = nil, + kind: String? = nil, severity: Int, timestamp: Int, type: String ) { self._internal = _internal - self.additional = additional + self.category = category self.component = component self.description = description self.endTimestamp = endTimestamp + self.issueTags = issueTags + self.kind = kind self.severity = severity self.timestamp = timestamp self.type = type @@ -37,10 +43,12 @@ public final class CallEvent: @unchecked Sendable, Codable, JSONEncodable, Hasha public enum CodingKeys: String, CodingKey, CaseIterable { case _internal = "internal" - case additional + case category case component case description case endTimestamp = "end_timestamp" + case issueTags = "issue_tags" + case kind case severity case timestamp case type @@ -48,10 +56,12 @@ public final class CallEvent: @unchecked Sendable, Codable, JSONEncodable, Hasha public static func == (lhs: CallEvent, rhs: CallEvent) -> Bool { lhs._internal == rhs._internal && - lhs.additional == rhs.additional && + lhs.category == rhs.category && lhs.component == rhs.component && lhs.description == rhs.description && lhs.endTimestamp == rhs.endTimestamp && + lhs.issueTags == rhs.issueTags && + lhs.kind == rhs.kind && lhs.severity == rhs.severity && lhs.timestamp == rhs.timestamp && lhs.type == rhs.type @@ -59,10 +69,12 @@ public final class CallEvent: @unchecked Sendable, Codable, JSONEncodable, Hasha public func hash(into hasher: inout Hasher) { hasher.combine(_internal) - hasher.combine(additional) + hasher.combine(category) hasher.combine(component) hasher.combine(description) hasher.combine(endTimestamp) + hasher.combine(issueTags) + hasher.combine(kind) hasher.combine(severity) hasher.combine(timestamp) hasher.combine(type) diff --git a/Sources/StreamVideo/OpenApi/generated/Models/CallResponse.swift b/Sources/StreamVideo/OpenApi/generated/Models/CallResponse.swift index 57085ed48..8ede7daea 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/CallResponse.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/CallResponse.swift @@ -8,6 +8,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha public var backstage: Bool public var blockedUserIds: [String] + public var captioning: Bool? public var cid: String public var createdAt: Date public var createdBy: UserResponse @@ -31,6 +32,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha public init( backstage: Bool, blockedUserIds: [String], + captioning: Bool? = nil, cid: String, createdAt: Date, createdBy: UserResponse, @@ -53,6 +55,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha ) { self.backstage = backstage self.blockedUserIds = blockedUserIds + self.captioning = captioning self.cid = cid self.createdAt = createdAt self.createdBy = createdBy @@ -77,6 +80,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha public enum CodingKeys: String, CodingKey, CaseIterable { case backstage case blockedUserIds = "blocked_user_ids" + case captioning case cid case createdAt = "created_at" case createdBy = "created_by" @@ -101,6 +105,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha public static func == (lhs: CallResponse, rhs: CallResponse) -> Bool { lhs.backstage == rhs.backstage && lhs.blockedUserIds == rhs.blockedUserIds && + lhs.captioning == rhs.captioning && lhs.cid == rhs.cid && lhs.createdAt == rhs.createdAt && lhs.createdBy == rhs.createdBy && @@ -125,6 +130,7 @@ public final class CallResponse: @unchecked Sendable, Codable, JSONEncodable, Ha public func hash(into hasher: inout Hasher) { hasher.combine(backstage) hasher.combine(blockedUserIds) + hasher.combine(captioning) hasher.combine(cid) hasher.combine(createdAt) hasher.combine(createdBy) diff --git a/Sources/StreamVideo/OpenApi/generated/Models/OwnCapability.swift b/Sources/StreamVideo/OpenApi/generated/Models/OwnCapability.swift index 823d6c9ce..c0a246119 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/OwnCapability.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/OwnCapability.swift @@ -22,9 +22,11 @@ public enum OwnCapability: String, Sendable, Codable, CaseIterable { case sendAudio = "send-audio" case sendVideo = "send-video" case startBroadcastCall = "start-broadcast-call" + case startClosedCaptionsCall = "start-closed-captions-call" case startRecordCall = "start-record-call" case startTranscriptionCall = "start-transcription-call" case stopBroadcastCall = "stop-broadcast-call" + case stopClosedCaptionsCall = "stop-closed-captions-call" case stopRecordCall = "stop-record-call" case stopTranscriptionCall = "stop-transcription-call" case updateCall = "update-call" diff --git a/Sources/StreamVideo/OpenApi/generated/Models/StartClosedCaptionsResponse.swift b/Sources/StreamVideo/OpenApi/generated/Models/StartClosedCaptionsResponse.swift new file mode 100644 index 000000000..a304b5e1a --- /dev/null +++ b/Sources/StreamVideo/OpenApi/generated/Models/StartClosedCaptionsResponse.swift @@ -0,0 +1,26 @@ +// +// Copyright © 2024 Stream.io Inc. All rights reserved. +// + +import Foundation + +public final class StartClosedCaptionsResponse: @unchecked Sendable, Codable, JSONEncodable, Hashable { + + public var duration: String + + public init(duration: String) { + self.duration = duration + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case duration + } + + public static func == (lhs: StartClosedCaptionsResponse, rhs: StartClosedCaptionsResponse) -> Bool { + lhs.duration == rhs.duration + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(duration) + } +} diff --git a/Sources/StreamVideo/OpenApi/generated/Models/StopClosedCaptionsResponse.swift b/Sources/StreamVideo/OpenApi/generated/Models/StopClosedCaptionsResponse.swift new file mode 100644 index 000000000..60a2868d1 --- /dev/null +++ b/Sources/StreamVideo/OpenApi/generated/Models/StopClosedCaptionsResponse.swift @@ -0,0 +1,26 @@ +// +// Copyright © 2024 Stream.io Inc. All rights reserved. +// + +import Foundation + +public final class StopClosedCaptionsResponse: @unchecked Sendable, Codable, JSONEncodable, Hashable { + + public var duration: String + + public init(duration: String) { + self.duration = duration + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case duration + } + + public static func == (lhs: StopClosedCaptionsResponse, rhs: StopClosedCaptionsResponse) -> Bool { + lhs.duration == rhs.duration + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(duration) + } +} diff --git a/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettings.swift b/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettings.swift index b1dc47cfb..18dd717a6 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettings.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettings.swift @@ -6,6 +6,23 @@ import Foundation public final class TranscriptionSettings: @unchecked Sendable, Codable, JSONEncodable, Hashable { + public enum ClosedCaptionMode: String, Sendable, Codable, CaseIterable { + case autoOn = "auto-on" + case available + case disabled + case unknown = "_unknown" + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let decodedValue = try? container.decode(String.self), + let value = Self(rawValue: decodedValue) { + self = value + } else { + self = .unknown + } + } + } + public enum Mode: String, Sendable, Codable, CaseIterable { case autoOn = "auto-on" case available @@ -23,11 +40,11 @@ public final class TranscriptionSettings: @unchecked Sendable, Codable, JSONEnco } } - public var closedCaptionMode: String + public var closedCaptionMode: ClosedCaptionMode public var languages: [String] public var mode: Mode - public init(closedCaptionMode: String, languages: [String], mode: Mode) { + public init(closedCaptionMode: ClosedCaptionMode, languages: [String], mode: Mode) { self.closedCaptionMode = closedCaptionMode self.languages = languages self.mode = mode diff --git a/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettingsRequest.swift b/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettingsRequest.swift index 5331d3871..a1d463f79 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettingsRequest.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/TranscriptionSettingsRequest.swift @@ -6,6 +6,23 @@ import Foundation public final class TranscriptionSettingsRequest: @unchecked Sendable, Codable, JSONEncodable, Hashable { + public enum ClosedCaptionMode: String, Sendable, Codable, CaseIterable { + case autoOn = "auto-on" + case available + case disabled + case unknown = "_unknown" + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let decodedValue = try? container.decode(String.self), + let value = Self(rawValue: decodedValue) { + self = value + } else { + self = .unknown + } + } + } + public enum Mode: String, Sendable, Codable, CaseIterable { case autoOn = "auto-on" case available @@ -23,11 +40,11 @@ public final class TranscriptionSettingsRequest: @unchecked Sendable, Codable, J } } - public var closedCaptionMode: String? + public var closedCaptionMode: ClosedCaptionMode? public var languages: [String]? public var mode: Mode - public init(closedCaptionMode: String? = nil, languages: [String]? = nil, mode: Mode) { + public init(closedCaptionMode: ClosedCaptionMode? = nil, languages: [String]? = nil, mode: Mode) { self.closedCaptionMode = closedCaptionMode self.languages = languages self.mode = mode diff --git a/Sources/StreamVideo/OpenApi/generated/Models/UserInfoResponse.swift b/Sources/StreamVideo/OpenApi/generated/Models/UserInfoResponse.swift index f641c51ab..77ee06cf8 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/UserInfoResponse.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/UserInfoResponse.swift @@ -7,12 +7,14 @@ import Foundation public final class UserInfoResponse: @unchecked Sendable, Codable, JSONEncodable, Hashable { public var custom: [String: RawJSON] + public var id: String? public var image: String public var name: String public var roles: [String] - public init(custom: [String: RawJSON], image: String, name: String, roles: [String]) { + public init(custom: [String: RawJSON], id: String? = nil, image: String, name: String, roles: [String]) { self.custom = custom + self.id = id self.image = image self.name = name self.roles = roles @@ -20,6 +22,7 @@ public final class UserInfoResponse: @unchecked Sendable, Codable, JSONEncodable public enum CodingKeys: String, CodingKey, CaseIterable { case custom + case id case image case name case roles @@ -27,6 +30,7 @@ public final class UserInfoResponse: @unchecked Sendable, Codable, JSONEncodable public static func == (lhs: UserInfoResponse, rhs: UserInfoResponse) -> Bool { lhs.custom == rhs.custom && + lhs.id == rhs.id && lhs.image == rhs.image && lhs.name == rhs.name && lhs.roles == rhs.roles @@ -34,6 +38,7 @@ public final class UserInfoResponse: @unchecked Sendable, Codable, JSONEncodable public func hash(into hasher: inout Hasher) { hasher.combine(custom) + hasher.combine(id) hasher.combine(image) hasher.combine(name) hasher.combine(roles) diff --git a/Sources/StreamVideo/OpenApi/generated/Models/VideoEvent.swift b/Sources/StreamVideo/OpenApi/generated/Models/VideoEvent.swift index abed5c1b0..ab962964d 100644 --- a/Sources/StreamVideo/OpenApi/generated/Models/VideoEvent.swift +++ b/Sources/StreamVideo/OpenApi/generated/Models/VideoEvent.swift @@ -16,6 +16,9 @@ public enum VideoEvent: Codable, Hashable { case typeCallAcceptedEvent(CallAcceptedEvent) case typeBlockedUserEvent(BlockedUserEvent) case typeClosedCaptionEvent(ClosedCaptionEvent) + case typeCallClosedCaptionsFailedEvent(CallClosedCaptionsFailedEvent) + case typeCallClosedCaptionsStartedEvent(CallClosedCaptionsStartedEvent) + case typeCallClosedCaptionsStoppedEvent(CallClosedCaptionsStoppedEvent) case typeCallCreatedEvent(CallCreatedEvent) case typeCallDeletedEvent(CallDeletedEvent) case typeCallEndedEvent(CallEndedEvent) @@ -67,6 +70,12 @@ public enum VideoEvent: Codable, Hashable { return value.type case let .typeClosedCaptionEvent(value): return value.type + case let .typeCallClosedCaptionsFailedEvent(value): + return value.type + case let .typeCallClosedCaptionsStartedEvent(value): + return value.type + case let .typeCallClosedCaptionsStoppedEvent(value): + return value.type case let .typeCallCreatedEvent(value): return value.type case let .typeCallDeletedEvent(value): @@ -162,6 +171,12 @@ public enum VideoEvent: Codable, Hashable { return value case let .typeClosedCaptionEvent(value): return value + case let .typeCallClosedCaptionsFailedEvent(value): + return value + case let .typeCallClosedCaptionsStartedEvent(value): + return value + case let .typeCallClosedCaptionsStoppedEvent(value): + return value case let .typeCallCreatedEvent(value): return value case let .typeCallDeletedEvent(value): @@ -258,6 +273,12 @@ public enum VideoEvent: Codable, Hashable { try container.encode(value) case let .typeClosedCaptionEvent(value): try container.encode(value) + case let .typeCallClosedCaptionsFailedEvent(value): + try container.encode(value) + case let .typeCallClosedCaptionsStartedEvent(value): + try container.encode(value) + case let .typeCallClosedCaptionsStoppedEvent(value): + try container.encode(value) case let .typeCallCreatedEvent(value): try container.encode(value) case let .typeCallDeletedEvent(value): @@ -357,6 +378,15 @@ public enum VideoEvent: Codable, Hashable { } else if dto.type == "call.closed_caption" { let value = try container.decode(ClosedCaptionEvent.self) self = .typeClosedCaptionEvent(value) + } else if dto.type == "call.closed_captions_failed" { + let value = try container.decode(CallClosedCaptionsFailedEvent.self) + self = .typeCallClosedCaptionsFailedEvent(value) + } else if dto.type == "call.closed_captions_started" { + let value = try container.decode(CallClosedCaptionsStartedEvent.self) + self = .typeCallClosedCaptionsStartedEvent(value) + } else if dto.type == "call.closed_captions_stopped" { + let value = try container.decode(CallClosedCaptionsStoppedEvent.self) + self = .typeCallClosedCaptionsStoppedEvent(value) } else if dto.type == "call.created" { let value = try container.decode(CallCreatedEvent.self) self = .typeCallCreatedEvent(value) diff --git a/StreamVideo.xcodeproj/project.pbxproj b/StreamVideo.xcodeproj/project.pbxproj index 74544c0bc..355d8467f 100644 --- a/StreamVideo.xcodeproj/project.pbxproj +++ b/StreamVideo.xcodeproj/project.pbxproj @@ -1249,6 +1249,11 @@ 84FC2C1328ACDF3A00181490 /* ProtoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FC2C1228ACDF3A00181490 /* ProtoModel.swift */; }; 84FC2C2428AD1B5E00181490 /* WebRTCEventDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FC2C2328AD1B5E00181490 /* WebRTCEventDecoder.swift */; }; 84FC2C2828AD350100181490 /* WebRTCEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FC2C2728AD350100181490 /* WebRTCEvents.swift */; }; + 84FCE44D2CE208C400649F86 /* CallClosedCaptionsStartedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FCE4492CE208C400649F86 /* CallClosedCaptionsStartedEvent.swift */; }; + 84FCE44E2CE208C400649F86 /* StopClosedCaptionsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FCE44C2CE208C400649F86 /* StopClosedCaptionsResponse.swift */; }; + 84FCE44F2CE208C400649F86 /* CallClosedCaptionsFailedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FCE4482CE208C400649F86 /* CallClosedCaptionsFailedEvent.swift */; }; + 84FCE4502CE208C400649F86 /* CallClosedCaptionsStoppedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FCE44A2CE208C400649F86 /* CallClosedCaptionsStoppedEvent.swift */; }; + 84FCE4512CE208C400649F86 /* StartClosedCaptionsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FCE44B2CE208C400649F86 /* StartClosedCaptionsResponse.swift */; }; 84FFB06A2A8D1380005BA275 /* DemoCallTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FFB0692A8D1380005BA275 /* DemoCallTopView.swift */; }; /* End PBXBuildFile section */ @@ -2469,6 +2474,11 @@ 84FC2C1228ACDF3A00181490 /* ProtoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProtoModel.swift; sourceTree = ""; }; 84FC2C2328AD1B5E00181490 /* WebRTCEventDecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebRTCEventDecoder.swift; sourceTree = ""; }; 84FC2C2728AD350100181490 /* WebRTCEvents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebRTCEvents.swift; sourceTree = ""; }; + 84FCE4482CE208C400649F86 /* CallClosedCaptionsFailedEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallClosedCaptionsFailedEvent.swift; sourceTree = ""; }; + 84FCE4492CE208C400649F86 /* CallClosedCaptionsStartedEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallClosedCaptionsStartedEvent.swift; sourceTree = ""; }; + 84FCE44A2CE208C400649F86 /* CallClosedCaptionsStoppedEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallClosedCaptionsStoppedEvent.swift; sourceTree = ""; }; + 84FCE44B2CE208C400649F86 /* StartClosedCaptionsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartClosedCaptionsResponse.swift; sourceTree = ""; }; + 84FCE44C2CE208C400649F86 /* StopClosedCaptionsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopClosedCaptionsResponse.swift; sourceTree = ""; }; 84FFB0692A8D1380005BA275 /* DemoCallTopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoCallTopView.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -5033,6 +5043,11 @@ 84DC383E29ADFCFC00946713 /* Models */ = { isa = PBXGroup; children = ( + 84FCE4482CE208C400649F86 /* CallClosedCaptionsFailedEvent.swift */, + 84FCE4492CE208C400649F86 /* CallClosedCaptionsStartedEvent.swift */, + 84FCE44A2CE208C400649F86 /* CallClosedCaptionsStoppedEvent.swift */, + 84FCE44B2CE208C400649F86 /* StartClosedCaptionsResponse.swift */, + 84FCE44C2CE208C400649F86 /* StopClosedCaptionsResponse.swift */, 84F07BD02CB4804900422E58 /* NoiseCancellationSettingsRequest.swift */, 4157FF902C9AC9EC0093D839 /* RTMPBroadcastRequest.swift */, 842B8E002A2DFED700863A87 /* AcceptCallResponse.swift */, @@ -6424,7 +6439,6 @@ 40BBC4C62C638915002AEF92 /* WebRTCCoordinator.swift in Sources */, 841BAA392BD15CDE000C73E4 /* UserSessionStats.swift in Sources */, 406B3BD72C8F332200FC93A1 /* RTCVideoTrack+Sendable.swift in Sources */, - 406B3BE32C8F358600FC93A1 /* Stream_Video_Sfu_Models_Codec+Convenience.swift in Sources */, 4067F3132CDA33C6002E28BD /* RTCAudioSessionConfiguration+Default.swift in Sources */, 8409465829AF4EEC007AF5BF /* SendReactionRequest.swift in Sources */, 40BBC4BA2C627F83002AEF92 /* TrackEvent.swift in Sources */, @@ -6683,6 +6697,11 @@ 84DC38AA29ADFCFD00946713 /* CallRecordingStoppedEvent.swift in Sources */, 84DC38CE29ADFCFD00946713 /* BlockUserRequest.swift in Sources */, 406B3C192C90385100FC93A1 /* VideoCapturerProviding.swift in Sources */, + 84FCE44D2CE208C400649F86 /* CallClosedCaptionsStartedEvent.swift in Sources */, + 84FCE44E2CE208C400649F86 /* StopClosedCaptionsResponse.swift in Sources */, + 84FCE44F2CE208C400649F86 /* CallClosedCaptionsFailedEvent.swift in Sources */, + 84FCE4502CE208C400649F86 /* CallClosedCaptionsStoppedEvent.swift in Sources */, + 84FCE4512CE208C400649F86 /* StartClosedCaptionsResponse.swift in Sources */, 841FF51B2A5FED4800809BBB /* SystemEnvironment+XStreamClient.swift in Sources */, 84DC38A329ADFCFD00946713 /* MuteUsersResponse.swift in Sources */, 84DC38BF29ADFCFD00946713 /* ScreensharingSettings.swift in Sources */, diff --git a/StreamVideoTests/Mock/MockResponseBuilder.swift b/StreamVideoTests/Mock/MockResponseBuilder.swift index 7d833e552..e29095310 100644 --- a/StreamVideoTests/Mock/MockResponseBuilder.swift +++ b/StreamVideoTests/Mock/MockResponseBuilder.swift @@ -49,6 +49,7 @@ class MockResponseBuilder { let callResponse = CallResponse( backstage: false, blockedUserIds: [], + captioning: false, cid: cid, createdAt: Date(), createdBy: userResponse, @@ -145,7 +146,7 @@ class MockResponseBuilder { enabled: true ) let transcriptionSettings = TranscriptionSettings( - closedCaptionMode: "", + closedCaptionMode: .available, languages: [], mode: .disabled ) diff --git a/StreamVideoTests/Utilities/Dummy/CallResponse+Dummy.swift b/StreamVideoTests/Utilities/Dummy/CallResponse+Dummy.swift index 801e7bf6f..9d594925a 100644 --- a/StreamVideoTests/Utilities/Dummy/CallResponse+Dummy.swift +++ b/StreamVideoTests/Utilities/Dummy/CallResponse+Dummy.swift @@ -31,6 +31,7 @@ extension CallResponse { .init( backstage: backstage, blockedUserIds: blockedUserIds, + captioning: false, cid: cid, createdAt: createdAt, createdBy: createdBy, diff --git a/StreamVideoTests/Utilities/Dummy/TranscriptionSettings+Dummy.swift b/StreamVideoTests/Utilities/Dummy/TranscriptionSettings+Dummy.swift index e1aecd8dd..cd5068094 100644 --- a/StreamVideoTests/Utilities/Dummy/TranscriptionSettings+Dummy.swift +++ b/StreamVideoTests/Utilities/Dummy/TranscriptionSettings+Dummy.swift @@ -7,7 +7,7 @@ import StreamVideo extension TranscriptionSettings { static func dummy( - closedCaptionMode: String = "", + closedCaptionMode: ClosedCaptionMode = .available, mode: Mode = .available ) -> TranscriptionSettings { .init(