jellyflood/JellyfinPlayer/Swaggers/APIs/CollectionAPI.swift

161 lines
6.6 KiB
Swift

//
// CollectionAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
import Alamofire
open class CollectionAPI {
/**
Adds items to a collection.
- parameter collectionId: (path) The collection id.
- parameter ids: (query) Item ids, comma delimited.
- parameter completion: completion handler to receive the data and the error objects
*/
open class func addToCollection(collectionId: UUID, ids: [UUID], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addToCollectionWithRequestBuilder(collectionId: collectionId, ids: ids).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
completion(nil, error)
}
}
}
/**
Adds items to a collection.
- POST /Collections/{collectionId}/Items
-
- API Key:
- type: apiKey X-Emby-Authorization
- name: CustomAuthentication
- parameter collectionId: (path) The collection id.
- parameter ids: (query) Item ids, comma delimited.
- returns: RequestBuilder<Void>
*/
open class func addToCollectionWithRequestBuilder(collectionId: UUID, ids: [UUID]) -> RequestBuilder<Void> {
var path = "/Collections/{collectionId}/Items"
let collectionIdPreEscape = "\(collectionId)"
let collectionIdPostEscape = collectionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{collectionId}", with: collectionIdPostEscape, options: .literal, range: nil)
let URLString = SwaggerClientAPI.basePath + path
let parameters: [String:Any]? = nil
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
"ids": ids
])
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
}
/**
Creates a new collection.
- parameter name: (query) The name of the collection. (optional)
- parameter ids: (query) Item Ids to add to the collection. (optional)
- parameter parentId: (query) Optional. Create the collection within a specific folder. (optional)
- parameter isLocked: (query) Whether or not to lock the new collection. (optional, default to false)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createCollection(name: String? = nil, ids: [String]? = nil, parentId: UUID? = nil, isLocked: Bool? = nil, completion: @escaping ((_ data: CollectionCreationResult?,_ error: Error?) -> Void)) {
createCollectionWithRequestBuilder(name: name, ids: ids, parentId: parentId, isLocked: isLocked).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
/**
Creates a new collection.
- POST /Collections
-
- API Key:
- type: apiKey X-Emby-Authorization
- name: CustomAuthentication
- examples: [{contentType=application/json, example={
"Id" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}}]
- parameter name: (query) The name of the collection. (optional)
- parameter ids: (query) Item Ids to add to the collection. (optional)
- parameter parentId: (query) Optional. Create the collection within a specific folder. (optional)
- parameter isLocked: (query) Whether or not to lock the new collection. (optional, default to false)
- returns: RequestBuilder<CollectionCreationResult>
*/
open class func createCollectionWithRequestBuilder(name: String? = nil, ids: [String]? = nil, parentId: UUID? = nil, isLocked: Bool? = nil) -> RequestBuilder<CollectionCreationResult> {
let path = "/Collections"
let URLString = SwaggerClientAPI.basePath + path
let parameters: [String:Any]? = nil
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
"name": name,
"ids": ids,
"parentId": parentId,
"isLocked": isLocked
])
let requestBuilder: RequestBuilder<CollectionCreationResult>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
}
/**
Removes items from a collection.
- parameter collectionId: (path) The collection id.
- parameter ids: (query) Item ids, comma delimited.
- parameter completion: completion handler to receive the data and the error objects
*/
open class func removeFromCollection(collectionId: UUID, ids: [UUID], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
removeFromCollectionWithRequestBuilder(collectionId: collectionId, ids: ids).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
completion(nil, error)
}
}
}
/**
Removes items from a collection.
- DELETE /Collections/{collectionId}/Items
-
- API Key:
- type: apiKey X-Emby-Authorization
- name: CustomAuthentication
- parameter collectionId: (path) The collection id.
- parameter ids: (query) Item ids, comma delimited.
- returns: RequestBuilder<Void>
*/
open class func removeFromCollectionWithRequestBuilder(collectionId: UUID, ids: [UUID]) -> RequestBuilder<Void> {
var path = "/Collections/{collectionId}/Items"
let collectionIdPreEscape = "\(collectionId)"
let collectionIdPostEscape = collectionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{collectionId}", with: collectionIdPostEscape, options: .literal, range: nil)
let URLString = SwaggerClientAPI.basePath + path
let parameters: [String:Any]? = nil
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
"ids": ids
])
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
}
}