// // HlsSegmentAPI.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation import Alamofire open class HlsSegmentAPI { /** Gets the specified audio segment for an audio item. - parameter itemId: (path) The item id. - parameter segmentId: (path) The segment id. - parameter completion: completion handler to receive the data and the error objects */ open class func getHlsAudioSegmentLegacyAac(itemId: String, segmentId: String, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) { getHlsAudioSegmentLegacyAacWithRequestBuilder(itemId: itemId, segmentId: segmentId).execute { (response, error) -> Void in completion(response?.body, error) } } /** Gets the specified audio segment for an audio item. - GET /Audio/{itemId}/hls/{segmentId}/stream.aac - - examples: [{contentType=application/json, example=""}] - parameter itemId: (path) The item id. - parameter segmentId: (path) The segment id. - returns: RequestBuilder */ open class func getHlsAudioSegmentLegacyAacWithRequestBuilder(itemId: String, segmentId: String) -> RequestBuilder { var path = "/Audio/{itemId}/hls/{segmentId}/stream.aac" let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let segmentIdPreEscape = "\(segmentId)" let segmentIdPostEscape = segmentIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{segmentId}", with: segmentIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Gets the specified audio segment for an audio item. - parameter itemId: (path) The item id. - parameter segmentId: (path) The segment id. - parameter completion: completion handler to receive the data and the error objects */ open class func getHlsAudioSegmentLegacyMp3(itemId: String, segmentId: String, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) { getHlsAudioSegmentLegacyMp3WithRequestBuilder(itemId: itemId, segmentId: segmentId).execute { (response, error) -> Void in completion(response?.body, error) } } /** Gets the specified audio segment for an audio item. - GET /Audio/{itemId}/hls/{segmentId}/stream.mp3 - - examples: [{contentType=application/json, example=""}] - parameter itemId: (path) The item id. - parameter segmentId: (path) The segment id. - returns: RequestBuilder */ open class func getHlsAudioSegmentLegacyMp3WithRequestBuilder(itemId: String, segmentId: String) -> RequestBuilder { var path = "/Audio/{itemId}/hls/{segmentId}/stream.mp3" let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let segmentIdPreEscape = "\(segmentId)" let segmentIdPostEscape = segmentIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{segmentId}", with: segmentIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Gets a hls video playlist. - parameter itemId: (path) The video id. - parameter playlistId: (path) The playlist id. - parameter completion: completion handler to receive the data and the error objects */ open class func getHlsPlaylistLegacy(itemId: String, playlistId: String, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) { getHlsPlaylistLegacyWithRequestBuilder(itemId: itemId, playlistId: playlistId).execute { (response, error) -> Void in completion(response?.body, error) } } /** Gets a hls video playlist. - GET /Videos/{itemId}/hls/{playlistId}/stream.m3u8 - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - examples: [{contentType=application/json, example=""}] - parameter itemId: (path) The video id. - parameter playlistId: (path) The playlist id. - returns: RequestBuilder */ open class func getHlsPlaylistLegacyWithRequestBuilder(itemId: String, playlistId: String) -> RequestBuilder { var path = "/Videos/{itemId}/hls/{playlistId}/stream.m3u8" let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let playlistIdPreEscape = "\(playlistId)" let playlistIdPostEscape = playlistIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{playlistId}", with: playlistIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Gets a hls video segment. - parameter itemId: (path) The item id. - parameter playlistId: (path) The playlist id. - parameter segmentId: (path) The segment id. - parameter segmentContainer: (path) The segment container. - parameter completion: completion handler to receive the data and the error objects */ open class func getHlsVideoSegmentLegacy(itemId: String, playlistId: String, segmentId: String, segmentContainer: String, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) { getHlsVideoSegmentLegacyWithRequestBuilder(itemId: itemId, playlistId: playlistId, segmentId: segmentId, segmentContainer: segmentContainer).execute { (response, error) -> Void in completion(response?.body, error) } } /** Gets a hls video segment. - GET /Videos/{itemId}/hls/{playlistId}/{segmentId}.{segmentContainer} - - examples: [{contentType=application/json, example=""}] - parameter itemId: (path) The item id. - parameter playlistId: (path) The playlist id. - parameter segmentId: (path) The segment id. - parameter segmentContainer: (path) The segment container. - returns: RequestBuilder */ open class func getHlsVideoSegmentLegacyWithRequestBuilder(itemId: String, playlistId: String, segmentId: String, segmentContainer: String) -> RequestBuilder { var path = "/Videos/{itemId}/hls/{playlistId}/{segmentId}.{segmentContainer}" let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let playlistIdPreEscape = "\(playlistId)" let playlistIdPostEscape = playlistIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{playlistId}", with: playlistIdPostEscape, options: .literal, range: nil) let segmentIdPreEscape = "\(segmentId)" let segmentIdPostEscape = segmentIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{segmentId}", with: segmentIdPostEscape, options: .literal, range: nil) let segmentContainerPreEscape = "\(segmentContainer)" let segmentContainerPostEscape = segmentContainerPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{segmentContainer}", with: segmentContainerPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Stops an active encoding. - parameter deviceId: (query) The device id of the client requesting. Used to stop encoding processes when needed. - parameter playSessionId: (query) The play session id. - parameter completion: completion handler to receive the data and the error objects */ open class func stopEncodingProcess(deviceId: String, playSessionId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { stopEncodingProcessWithRequestBuilder(deviceId: deviceId, playSessionId: playSessionId).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Stops an active encoding. - DELETE /Videos/ActiveEncodings - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter deviceId: (query) The device id of the client requesting. Used to stop encoding processes when needed. - parameter playSessionId: (query) The play session id. - returns: RequestBuilder */ open class func stopEncodingProcessWithRequestBuilder(deviceId: String, playSessionId: String) -> RequestBuilder { let path = "/Videos/ActiveEncodings" let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "deviceId": deviceId, "playSessionId": playSessionId ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } }