297 lines
10 KiB
Swift
297 lines
10 KiB
Swift
//
|
|
// ScheduledTasksAPI.swift
|
|
//
|
|
// Generated by swagger-codegen
|
|
// https://github.com/swagger-api/swagger-codegen
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
|
|
open class ScheduledTasksAPI {
|
|
/**
|
|
Get task by id.
|
|
|
|
- parameter taskId: (path) Task Id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getTask(taskId: String, completion: @escaping ((_ data: TaskInfo?,_ error: Error?) -> Void)) {
|
|
getTaskWithRequestBuilder(taskId: taskId).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Get task by id.
|
|
- GET /ScheduledTasks/{taskId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example={
|
|
"IsHidden" : true,
|
|
"Description" : "Description",
|
|
"Category" : "Category",
|
|
"State" : "",
|
|
"CurrentProgressPercentage" : 0.8008281904610115,
|
|
"Triggers" : [ {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
}, {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
} ],
|
|
"Id" : "Id",
|
|
"LastExecutionResult" : "",
|
|
"Key" : "Key",
|
|
"Name" : "Name"
|
|
}}]
|
|
- parameter taskId: (path) Task Id.
|
|
|
|
- returns: RequestBuilder<TaskInfo>
|
|
*/
|
|
open class func getTaskWithRequestBuilder(taskId: String) -> RequestBuilder<TaskInfo> {
|
|
var path = "/ScheduledTasks/{taskId}"
|
|
let taskIdPreEscape = "\(taskId)"
|
|
let taskIdPostEscape = taskIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{taskId}", with: taskIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<TaskInfo>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Get tasks.
|
|
|
|
- parameter isHidden: (query) Optional filter tasks that are hidden, or not. (optional)
|
|
- parameter isEnabled: (query) Optional filter tasks that are enabled, or not. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getTasks(isHidden: Bool? = nil, isEnabled: Bool? = nil, completion: @escaping ((_ data: [TaskInfo]?,_ error: Error?) -> Void)) {
|
|
getTasksWithRequestBuilder(isHidden: isHidden, isEnabled: isEnabled).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Get tasks.
|
|
- GET /ScheduledTasks
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"IsHidden" : true,
|
|
"Description" : "Description",
|
|
"Category" : "Category",
|
|
"State" : "",
|
|
"CurrentProgressPercentage" : 0.8008281904610115,
|
|
"Triggers" : [ {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
}, {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
} ],
|
|
"Id" : "Id",
|
|
"LastExecutionResult" : "",
|
|
"Key" : "Key",
|
|
"Name" : "Name"
|
|
}, {
|
|
"IsHidden" : true,
|
|
"Description" : "Description",
|
|
"Category" : "Category",
|
|
"State" : "",
|
|
"CurrentProgressPercentage" : 0.8008281904610115,
|
|
"Triggers" : [ {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
}, {
|
|
"DayOfWeek" : "",
|
|
"Type" : "Type",
|
|
"IntervalTicks" : 1,
|
|
"TimeOfDayTicks" : 6,
|
|
"MaxRuntimeTicks" : 5
|
|
} ],
|
|
"Id" : "Id",
|
|
"LastExecutionResult" : "",
|
|
"Key" : "Key",
|
|
"Name" : "Name"
|
|
} ]}]
|
|
- parameter isHidden: (query) Optional filter tasks that are hidden, or not. (optional)
|
|
- parameter isEnabled: (query) Optional filter tasks that are enabled, or not. (optional)
|
|
|
|
- returns: RequestBuilder<[TaskInfo]>
|
|
*/
|
|
open class func getTasksWithRequestBuilder(isHidden: Bool? = nil, isEnabled: Bool? = nil) -> RequestBuilder<[TaskInfo]> {
|
|
let path = "/ScheduledTasks"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"isHidden": isHidden,
|
|
"isEnabled": isEnabled
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[TaskInfo]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Start specified task.
|
|
|
|
- parameter taskId: (path) Task Id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func startTask(taskId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
startTaskWithRequestBuilder(taskId: taskId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Start specified task.
|
|
- POST /ScheduledTasks/Running/{taskId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter taskId: (path) Task Id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func startTaskWithRequestBuilder(taskId: String) -> RequestBuilder<Void> {
|
|
var path = "/ScheduledTasks/Running/{taskId}"
|
|
let taskIdPreEscape = "\(taskId)"
|
|
let taskIdPostEscape = taskIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{taskId}", with: taskIdPostEscape, 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: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Stop specified task.
|
|
|
|
- parameter taskId: (path) Task Id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func stopTask(taskId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
stopTaskWithRequestBuilder(taskId: taskId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Stop specified task.
|
|
- DELETE /ScheduledTasks/Running/{taskId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter taskId: (path) Task Id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func stopTaskWithRequestBuilder(taskId: String) -> RequestBuilder<Void> {
|
|
var path = "/ScheduledTasks/Running/{taskId}"
|
|
let taskIdPreEscape = "\(taskId)"
|
|
let taskIdPostEscape = taskIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{taskId}", with: taskIdPostEscape, 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)
|
|
}
|
|
/**
|
|
Update specified task triggers.
|
|
|
|
- parameter body: (body) Triggers.
|
|
- parameter taskId: (path) Task Id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func updateTask(body: [TaskTriggerInfo], taskId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
updateTaskWithRequestBuilder(body: body, taskId: taskId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Update specified task triggers.
|
|
- POST /ScheduledTasks/{taskId}/Triggers
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) Triggers.
|
|
- parameter taskId: (path) Task Id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func updateTaskWithRequestBuilder(body: [TaskTriggerInfo], taskId: String) -> RequestBuilder<Void> {
|
|
var path = "/ScheduledTasks/{taskId}/Triggers"
|
|
let taskIdPreEscape = "\(taskId)"
|
|
let taskIdPostEscape = taskIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{taskId}", with: taskIdPostEscape, options: .literal, range: nil)
|
|
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)
|
|
}
|
|
}
|