Skip to content

Commit

Permalink
Generated new version of the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski committed Dec 23, 2024
1 parent 249741c commit 0c8d779
Show file tree
Hide file tree
Showing 45 changed files with 1,207 additions and 57 deletions.
4 changes: 3 additions & 1 deletion Scripts/renamed-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
"ThumbnailsSettingsResponse": "ThumbnailsSettings",
"VideoSettingsResponse": "VideoSettings",
"TimeStats": "Stats",
"NoiseCancellationSettings": "NoiseCancellationSettingsRequest"
"NoiseCancellationSettings": "NoiseCancellationSettingsRequest",
"VideoDimension": "VideoResolution",
"DeviceResponse": "Device"
}
25 changes: 19 additions & 6 deletions Sources/StreamVideo/Call.swift
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,15 @@ public class Call: @unchecked Sendable, WSEventsSubscriber {
/// Stops an ongoing live call.
@discardableResult
public func stopLive() async throws -> StopLiveResponse {
try await coordinatorClient.stopLive(type: callType, id: callId)
try await stopLive(request: .init())
}

public func stopLive(request: StopLiveRequest) async throws -> StopLiveResponse {
try await coordinatorClient.stopLive(
type: callType,
id: callId,
stopLiveRequest: request
)
}

// MARK: - Recording
Expand Down Expand Up @@ -786,7 +794,7 @@ public class Call: @unchecked Sendable, WSEventsSubscriber {
/// - Throws: An error if the sending fails.
@discardableResult
public func sendCustomEvent(_ data: [String: RawJSON]) async throws -> SendEventResponse {
try await coordinatorClient.sendEvent(
try await coordinatorClient.sendCallEvent(
type: callType,
id: callId,
sendEventRequest: SendEventRequest(custom: data)
Expand Down Expand Up @@ -1087,14 +1095,19 @@ public class Call: @unchecked Sendable, WSEventsSubscriber {

/// Stops a conversation from being transcribed and returns whether the stop request was successful
/// or not.
///
/// - Returns: A StopTranscriptionResponse indicating whether the stop request was successful
/// - Parameter stopClosedCaptions: A boolean value indicating whether to stop closed captions.
/// - Returns: A StopTranscriptionResponse indicating whether the stop request was successful.
/// or not.
@discardableResult
public func stopTranscription() async throws -> StopTranscriptionResponse {
public func stopTranscription(
stopClosedCaptions: Bool? = nil
) async throws -> StopTranscriptionResponse {
try await coordinatorClient.stopTranscription(
type: callType,
id: callId
id: callId,
stopTranscriptionRequest: StopTranscriptionRequest(
stopClosedCaptions: stopClosedCaptions
)
)
}

Expand Down
53 changes: 44 additions & 9 deletions Sources/StreamVideo/OpenApi/generated/APIs/DefaultAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {
}
}

open func startClosedCaptions(type: String, id: String) async throws -> StartClosedCaptionsResponse {
open func startClosedCaptions(
type: String,
id: String,
startClosedCaptionsRequest: StartClosedCaptionsRequest
) async throws -> StartClosedCaptionsResponse {
var path = "/video/call/{type}/{id}/start_closed_captions"

let typePreEscape = "\(APIHelper.mapValueToPathItem(type))"
Expand All @@ -677,7 +681,8 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {

let urlRequest = try makeRequest(
uriPath: path,
httpMethod: "POST"
httpMethod: "POST",
request: startClosedCaptionsRequest
)
return try await send(request: urlRequest) {
try self.jsonDecoder.decode(StartClosedCaptionsResponse.self, from: $0)
Expand Down Expand Up @@ -778,7 +783,11 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {
}
}

open func stopClosedCaptions(type: String, id: String) async throws -> StopClosedCaptionsResponse {
open func stopClosedCaptions(
type: String,
id: String,
stopClosedCaptionsRequest: StopClosedCaptionsRequest
) async throws -> StopClosedCaptionsResponse {
var path = "/video/call/{type}/{id}/stop_closed_captions"

let typePreEscape = "\(APIHelper.mapValueToPathItem(type))"
Expand All @@ -790,7 +799,8 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {

let urlRequest = try makeRequest(
uriPath: path,
httpMethod: "POST"
httpMethod: "POST",
request: stopClosedCaptionsRequest
)
return try await send(request: urlRequest) {
try self.jsonDecoder.decode(StopClosedCaptionsResponse.self, from: $0)
Expand Down Expand Up @@ -836,7 +846,11 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {
}
}

open func stopTranscription(type: String, id: String) async throws -> StopTranscriptionResponse {
open func stopTranscription(
type: String,
id: String,
stopTranscriptionRequest: StopTranscriptionRequest
) async throws -> StopTranscriptionResponse {
var path = "/video/call/{type}/{id}/stop_transcription"

let typePreEscape = "\(APIHelper.mapValueToPathItem(type))"
Expand All @@ -848,7 +862,8 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {

let urlRequest = try makeRequest(
uriPath: path,
httpMethod: "POST"
httpMethod: "POST",
request: stopTranscriptionRequest
)
return try await send(request: urlRequest) {
try self.jsonDecoder.decode(StopTranscriptionResponse.self, from: $0)
Expand Down Expand Up @@ -1105,6 +1120,20 @@ open class DefaultAPI: DefaultAPIEndpoints, @unchecked Sendable {
try self.jsonDecoder.decode(EmptyResponse.self, from: $0)
}
}

open func queryAggregateCallStats(queryAggregateCallStatsRequest: QueryAggregateCallStatsRequest) async throws
-> QueryAggregateCallStatsResponse {
let path = "/video/stats"

let urlRequest = try makeRequest(
uriPath: path,
httpMethod: "POST",
request: queryAggregateCallStatsRequest
)
return try await send(request: urlRequest) {
try self.jsonDecoder.decode(QueryAggregateCallStatsResponse.self, from: $0)
}
}
}

protocol DefaultAPIEndpoints {
Expand Down Expand Up @@ -1166,7 +1195,8 @@ protocol DefaultAPIEndpoints {

func startHLSBroadcasting(type: String, id: String) async throws -> StartHLSBroadcastingResponse

func startClosedCaptions(type: String, id: String) async throws -> StartClosedCaptionsResponse
func startClosedCaptions(type: String, id: String, startClosedCaptionsRequest: StartClosedCaptionsRequest) async throws
-> StartClosedCaptionsResponse

func startRecording(type: String, id: String, startRecordingRequest: StartRecordingRequest) async throws
-> StartRecordingResponse
Expand All @@ -1178,13 +1208,15 @@ protocol DefaultAPIEndpoints {

func stopHLSBroadcasting(type: String, id: String) async throws -> StopHLSBroadcastingResponse

func stopClosedCaptions(type: String, id: String) async throws -> StopClosedCaptionsResponse
func stopClosedCaptions(type: String, id: String, stopClosedCaptionsRequest: StopClosedCaptionsRequest) async throws
-> StopClosedCaptionsResponse

func stopLive(type: String, id: String, stopLiveRequest: StopLiveRequest) async throws -> StopLiveResponse

func stopRecording(type: String, id: String) async throws -> StopRecordingResponse

func stopTranscription(type: String, id: String) async throws -> StopTranscriptionResponse
func stopTranscription(type: String, id: String, stopTranscriptionRequest: StopTranscriptionRequest) async throws
-> StopTranscriptionResponse

func listTranscriptions(type: String, id: String) async throws -> ListTranscriptionsResponse

Expand Down Expand Up @@ -1213,4 +1245,7 @@ protocol DefaultAPIEndpoints {
func createGuest(createGuestRequest: CreateGuestRequest) async throws -> CreateGuestResponse

func videoConnect() async throws -> Void

func queryAggregateCallStats(queryAggregateCallStatsRequest: QueryAggregateCallStatsRequest) async throws
-> QueryAggregateCallStatsResponse
}
31 changes: 31 additions & 0 deletions Sources/StreamVideo/OpenApi/generated/Models/Bound.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation

public final class Bound: @unchecked Sendable, Codable, JSONEncodable, Hashable {

public var inclusive: Bool
public var value: Float

public init(inclusive: Bool, value: Float) {
self.inclusive = inclusive
self.value = value
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case inclusive
case value
}

public static func == (lhs: Bound, rhs: Bound) -> Bool {
lhs.inclusive == rhs.inclusive &&
lhs.value == rhs.value
}

public func hash(into hasher: inout Hasher) {
hasher.combine(inclusive)
hasher.combine(value)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation

public final class CallDurationReport: @unchecked Sendable, Codable, JSONEncodable, Hashable {

public var histogram: [ReportByHistogramBucket]

public init(histogram: [ReportByHistogramBucket]) {
self.histogram = histogram
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case histogram
}

public static func == (lhs: CallDurationReport, rhs: CallDurationReport) -> Bool {
lhs.histogram == rhs.histogram
}

public func hash(into hasher: inout Hasher) {
hasher.combine(histogram)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation

public final class CallDurationReportResponse: @unchecked Sendable, Codable, JSONEncodable, Hashable {

public var daily: [DailyAggregateCallDurationReportResponse]

public init(daily: [DailyAggregateCallDurationReportResponse]) {
self.daily = daily
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case daily
}

public static func == (lhs: CallDurationReportResponse, rhs: CallDurationReportResponse) -> Bool {
lhs.daily == rhs.daily
}

public func hash(into hasher: inout Hasher) {
hasher.combine(daily)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation

public final class CallParticipantCountReport: @unchecked Sendable, Codable, JSONEncodable, Hashable {

public var histogram: [ReportByHistogramBucket]

public init(histogram: [ReportByHistogramBucket]) {
self.histogram = histogram
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case histogram
}

public static func == (lhs: CallParticipantCountReport, rhs: CallParticipantCountReport) -> Bool {
lhs.histogram == rhs.histogram
}

public func hash(into hasher: inout Hasher) {
hasher.combine(histogram)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation

public final class CallParticipantCountReportResponse: @unchecked Sendable, Codable, JSONEncodable, Hashable {

public var daily: [DailyAggregateCallParticipantCountReportResponse]

public init(daily: [DailyAggregateCallParticipantCountReportResponse]) {
self.daily = daily
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case daily
}

public static func == (lhs: CallParticipantCountReportResponse, rhs: CallParticipantCountReportResponse) -> Bool {
lhs.daily == rhs.daily
}

public func hash(into hasher: inout Hasher) {
hasher.combine(daily)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ public final class CallSessionParticipantLeftEvent: @unchecked Sendable, Event,

public var callCid: String
public var createdAt: Date
public var durationSeconds: Int
public var participant: CallParticipantResponse
public var sessionId: String
public var type: String = "call.session_participant_left"

public init(callCid: String, createdAt: Date, participant: CallParticipantResponse, sessionId: String) {
public init(callCid: String, createdAt: Date, durationSeconds: Int, participant: CallParticipantResponse, sessionId: String) {
self.callCid = callCid
self.createdAt = createdAt
self.durationSeconds = durationSeconds
self.participant = participant
self.sessionId = sessionId
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case callCid = "call_cid"
case createdAt = "created_at"
case durationSeconds = "duration_seconds"
case participant
case sessionId = "session_id"
case type
Expand All @@ -30,6 +33,7 @@ public final class CallSessionParticipantLeftEvent: @unchecked Sendable, Event,
public static func == (lhs: CallSessionParticipantLeftEvent, rhs: CallSessionParticipantLeftEvent) -> Bool {
lhs.callCid == rhs.callCid &&
lhs.createdAt == rhs.createdAt &&
lhs.durationSeconds == rhs.durationSeconds &&
lhs.participant == rhs.participant &&
lhs.sessionId == rhs.sessionId &&
lhs.type == rhs.type
Expand All @@ -38,6 +42,7 @@ public final class CallSessionParticipantLeftEvent: @unchecked Sendable, Event,
public func hash(into hasher: inout Hasher) {
hasher.combine(callCid)
hasher.combine(createdAt)
hasher.combine(durationSeconds)
hasher.combine(participant)
hasher.combine(sessionId)
hasher.combine(type)
Expand Down
Loading

0 comments on commit 0c8d779

Please sign in to comment.