361 lines
13 KiB
Swift
361 lines
13 KiB
Swift
//
|
|
// PackageAPI.swift
|
|
//
|
|
// Generated by swagger-codegen
|
|
// https://github.com/swagger-api/swagger-codegen
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
|
|
open class PackageAPI {
|
|
/**
|
|
Cancels a package installation.
|
|
|
|
- parameter packageId: (path) Installation Id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func cancelPackageInstallation(packageId: UUID, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
cancelPackageInstallationWithRequestBuilder(packageId: packageId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Cancels a package installation.
|
|
- DELETE /Packages/Installing/{packageId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter packageId: (path) Installation Id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func cancelPackageInstallationWithRequestBuilder(packageId: UUID) -> RequestBuilder<Void> {
|
|
var path = "/Packages/Installing/{packageId}"
|
|
let packageIdPreEscape = "\(packageId)"
|
|
let packageIdPostEscape = packageIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{packageId}", with: packageIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets a package by name or assembly GUID.
|
|
|
|
- parameter name: (path) The name of the package.
|
|
- parameter assemblyGuid: (query) The GUID of the associated assembly. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getPackageInfo(name: String, assemblyGuid: UUID? = nil, completion: @escaping ((_ data: PackageInfo?,_ error: Error?) -> Void)) {
|
|
getPackageInfoWithRequestBuilder(name: name, assemblyGuid: assemblyGuid).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets a package by name or assembly GUID.
|
|
- GET /Packages/{name}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example={
|
|
"owner" : "owner",
|
|
"overview" : "overview",
|
|
"versions" : [ {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
}, {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
} ],
|
|
"imageUrl" : "imageUrl",
|
|
"name" : "name",
|
|
"description" : "description",
|
|
"guid" : "guid",
|
|
"category" : "category"
|
|
}}]
|
|
- parameter name: (path) The name of the package.
|
|
- parameter assemblyGuid: (query) The GUID of the associated assembly. (optional)
|
|
|
|
- returns: RequestBuilder<PackageInfo>
|
|
*/
|
|
open class func getPackageInfoWithRequestBuilder(name: String, assemblyGuid: UUID? = nil) -> RequestBuilder<PackageInfo> {
|
|
var path = "/Packages/{name}"
|
|
let namePreEscape = "\(name)"
|
|
let namePostEscape = namePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{name}", with: namePostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"assemblyGuid": assemblyGuid
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<PackageInfo>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets available packages.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getPackages(completion: @escaping ((_ data: [PackageInfo]?,_ error: Error?) -> Void)) {
|
|
getPackagesWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets available packages.
|
|
- GET /Packages
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"owner" : "owner",
|
|
"overview" : "overview",
|
|
"versions" : [ {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
}, {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
} ],
|
|
"imageUrl" : "imageUrl",
|
|
"name" : "name",
|
|
"description" : "description",
|
|
"guid" : "guid",
|
|
"category" : "category"
|
|
}, {
|
|
"owner" : "owner",
|
|
"overview" : "overview",
|
|
"versions" : [ {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
}, {
|
|
"sourceUrl" : "sourceUrl",
|
|
"targetAbi" : "targetAbi",
|
|
"checksum" : "checksum",
|
|
"changelog" : "changelog",
|
|
"repositoryName" : "repositoryName",
|
|
"version" : "version",
|
|
"VersionNumber" : "",
|
|
"timestamp" : "timestamp",
|
|
"repositoryUrl" : "repositoryUrl"
|
|
} ],
|
|
"imageUrl" : "imageUrl",
|
|
"name" : "name",
|
|
"description" : "description",
|
|
"guid" : "guid",
|
|
"category" : "category"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[PackageInfo]>
|
|
*/
|
|
open class func getPackagesWithRequestBuilder() -> RequestBuilder<[PackageInfo]> {
|
|
let path = "/Packages"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[PackageInfo]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets all package repositories.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getRepositories(completion: @escaping ((_ data: [RepositoryInfo]?,_ error: Error?) -> Void)) {
|
|
getRepositoriesWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets all package repositories.
|
|
- GET /Repositories
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"Enabled" : true,
|
|
"Url" : "Url",
|
|
"Name" : "Name"
|
|
}, {
|
|
"Enabled" : true,
|
|
"Url" : "Url",
|
|
"Name" : "Name"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[RepositoryInfo]>
|
|
*/
|
|
open class func getRepositoriesWithRequestBuilder() -> RequestBuilder<[RepositoryInfo]> {
|
|
let path = "/Repositories"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[RepositoryInfo]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Installs a package.
|
|
|
|
- parameter name: (path) Package name.
|
|
- parameter assemblyGuid: (query) GUID of the associated assembly. (optional)
|
|
- parameter version: (query) Optional version. Defaults to latest version. (optional)
|
|
- parameter repositoryUrl: (query) Optional. Specify the repository to install from. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func installPackage(name: String, assemblyGuid: UUID? = nil, version: String? = nil, repositoryUrl: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
installPackageWithRequestBuilder(name: name, assemblyGuid: assemblyGuid, version: version, repositoryUrl: repositoryUrl).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Installs a package.
|
|
- POST /Packages/Installed/{name}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter name: (path) Package name.
|
|
- parameter assemblyGuid: (query) GUID of the associated assembly. (optional)
|
|
- parameter version: (query) Optional version. Defaults to latest version. (optional)
|
|
- parameter repositoryUrl: (query) Optional. Specify the repository to install from. (optional)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func installPackageWithRequestBuilder(name: String, assemblyGuid: UUID? = nil, version: String? = nil, repositoryUrl: String? = nil) -> RequestBuilder<Void> {
|
|
var path = "/Packages/Installed/{name}"
|
|
let namePreEscape = "\(name)"
|
|
let namePostEscape = namePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{name}", with: namePostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"assemblyGuid": assemblyGuid,
|
|
"version": version,
|
|
"repositoryUrl": repositoryUrl
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Sets the enabled and existing package repositories.
|
|
|
|
- parameter body: (body) The list of package repositories.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func setRepositories(body: [RepositoryInfo], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
setRepositoriesWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Sets the enabled and existing package repositories.
|
|
- POST /Repositories
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) The list of package repositories.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func setRepositoriesWithRequestBuilder(body: [RepositoryInfo]) -> RequestBuilder<Void> {
|
|
let path = "/Repositories"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
|
}
|
|
}
|