jellyflood/JellyfinPlayer/Swaggers/APIs/VideoAttachmentsAPI.swift

61 lines
2.6 KiB
Swift

//
// VideoAttachmentsAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
import Alamofire
open class VideoAttachmentsAPI {
/**
Get video attachment.
- parameter videoId: (path) Video ID.
- parameter mediaSourceId: (path) Media Source ID.
- parameter index: (path) Attachment Index.
- parameter completion: completion handler to receive the data and the error objects
*/
open class func getAttachment(videoId: UUID, mediaSourceId: String, index: Int, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) {
getAttachmentWithRequestBuilder(videoId: videoId, mediaSourceId: mediaSourceId, index: index).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
/**
Get video attachment.
- GET /Videos/{videoId}/{mediaSourceId}/Attachments/{index}
-
- examples: [{contentType=application/json, example=""}]
- parameter videoId: (path) Video ID.
- parameter mediaSourceId: (path) Media Source ID.
- parameter index: (path) Attachment Index.
- returns: RequestBuilder<Data>
*/
open class func getAttachmentWithRequestBuilder(videoId: UUID, mediaSourceId: String, index: Int) -> RequestBuilder<Data> {
var path = "/Videos/{videoId}/{mediaSourceId}/Attachments/{index}"
let videoIdPreEscape = "\(videoId)"
let videoIdPostEscape = videoIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{videoId}", with: videoIdPostEscape, options: .literal, range: nil)
let mediaSourceIdPreEscape = "\(mediaSourceId)"
let mediaSourceIdPostEscape = mediaSourceIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{mediaSourceId}", with: mediaSourceIdPostEscape, options: .literal, range: nil)
let indexPreEscape = "\(index)"
let indexPostEscape = indexPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{index}", with: indexPostEscape, options: .literal, range: nil)
let URLString = SwaggerClientAPI.basePath + path
let parameters: [String:Any]? = nil
let url = URLComponents(string: URLString)
let requestBuilder: RequestBuilder<Data>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
}
}