// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. import Foundation class _VideoAPI: VideoAPI { private let client: Client init(client: Client) { self.client = client } public func startUniversalTranscode(request: Operations.StartUniversalTranscodeRequest) async throws -> Response { return try await client.makeRequest( configureRequest: { configuration in try configureStartUniversalTranscodeRequest(with: configuration, request: request) }, handleResponse: handleStartUniversalTranscodeResponse ) } public func getTimeline(request: Operations.GetTimelineRequest) async throws -> Response { return try await client.makeRequest( configureRequest: { configuration in try configureGetTimelineRequest(with: configuration, request: request) }, handleResponse: handleGetTimelineResponse ) } } // MARK: - Request Configuration private func configureStartUniversalTranscodeRequest(with configuration: URLRequestConfiguration, request: Operations.StartUniversalTranscodeRequest) throws { configuration.path = "/video/:/transcode/universal/start.mpd" configuration.method = .get configuration.queryParameterSerializable = request configuration.telemetryHeader = .userAgent } private func configureGetTimelineRequest(with configuration: URLRequestConfiguration, request: Operations.GetTimelineRequest) throws { configuration.path = "/:/timeline" configuration.method = .get configuration.queryParameterSerializable = request configuration.telemetryHeader = .userAgent } // MARK: - Response Handlers private func handleStartUniversalTranscodeResponse(response: Client.APIResponse) throws -> Operations.StartUniversalTranscodeResponse { let httpResponse = response.httpResponse if [200, 400].contains(httpResponse.statusCode) { return .empty } else if httpResponse.statusCode == 401 { if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { do { return .object(try JSONDecoder().decode(Operations.StartUniversalTranscodeResponseBody.self, from: data)) } catch { throw ResponseHandlerError.failedToDecodeJSON(error) } } } return .empty } private func handleGetTimelineResponse(response: Client.APIResponse) throws -> Operations.GetTimelineResponse { let httpResponse = response.httpResponse if [200, 400].contains(httpResponse.statusCode) { return .empty } else if httpResponse.statusCode == 401 { if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { do { return .object(try JSONDecoder().decode(Operations.GetTimelineResponseBody.self, from: data)) } catch { throw ResponseHandlerError.failedToDecodeJSON(error) } } } return .empty }