869 lines
38 KiB
Swift
869 lines
38 KiB
Swift
//
|
|
// SessionAPI.swift
|
|
//
|
|
// Generated by swagger-codegen
|
|
// https://github.com/swagger-api/swagger-codegen
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
|
|
open class SessionAPI {
|
|
/**
|
|
Adds an additional user to a session.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter userId: (path) The user id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func addUserToSession(sessionId: String, userId: UUID, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
addUserToSessionWithRequestBuilder(sessionId: sessionId, userId: userId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Adds an additional user to a session.
|
|
- POST /Sessions/{sessionId}/User/{userId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter userId: (path) The user id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func addUserToSessionWithRequestBuilder(sessionId: String, userId: UUID) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/User/{userId}"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, 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)
|
|
}
|
|
/**
|
|
Instructs a session to browse to an item or view.
|
|
|
|
- parameter sessionId: (path) The session Id.
|
|
- parameter itemType: (query) The type of item to browse to.
|
|
- parameter itemId: (query) The Id of the item.
|
|
- parameter itemName: (query) The name of the item.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func displayContent(sessionId: String, itemType: String, itemId: String, itemName: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
displayContentWithRequestBuilder(sessionId: sessionId, itemType: itemType, itemId: itemId, itemName: itemName).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Instructs a session to browse to an item or view.
|
|
- POST /Sessions/{sessionId}/Viewing
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session Id.
|
|
- parameter itemType: (query) The type of item to browse to.
|
|
- parameter itemId: (query) The Id of the item.
|
|
- parameter itemName: (query) The name of the item.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func displayContentWithRequestBuilder(sessionId: String, itemType: String, itemId: String, itemName: String) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Viewing"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"itemType": itemType,
|
|
"itemId": itemId,
|
|
"itemName": itemName
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Get all auth providers.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getAuthProviders(completion: @escaping ((_ data: [NameIdPair]?,_ error: Error?) -> Void)) {
|
|
getAuthProvidersWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Get all auth providers.
|
|
- GET /Auth/Providers
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
}, {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[NameIdPair]>
|
|
*/
|
|
open class func getAuthProvidersWithRequestBuilder() -> RequestBuilder<[NameIdPair]> {
|
|
let path = "/Auth/Providers"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[NameIdPair]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Get all password reset providers.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getPasswordResetProviders(completion: @escaping ((_ data: [NameIdPair]?,_ error: Error?) -> Void)) {
|
|
getPasswordResetProvidersWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Get all password reset providers.
|
|
- GET /Auth/PasswordResetProviders
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
}, {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[NameIdPair]>
|
|
*/
|
|
open class func getPasswordResetProvidersWithRequestBuilder() -> RequestBuilder<[NameIdPair]> {
|
|
let path = "/Auth/PasswordResetProviders"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[NameIdPair]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets a list of sessions.
|
|
|
|
- parameter controllableByUserId: (query) Filter by sessions that a given user is allowed to remote control. (optional)
|
|
- parameter deviceId: (query) Filter by device Id. (optional)
|
|
- parameter activeWithinSeconds: (query) Optional. Filter by sessions that were active in the last n seconds. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getSessions(controllableByUserId: UUID? = nil, deviceId: String? = nil, activeWithinSeconds: Int? = nil, completion: @escaping ((_ data: [SessionInfo]?,_ error: Error?) -> Void)) {
|
|
getSessionsWithRequestBuilder(controllableByUserId: controllableByUserId, deviceId: deviceId, activeWithinSeconds: activeWithinSeconds).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets a list of sessions.
|
|
- GET /Sessions
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"ApplicationVersion" : "ApplicationVersion",
|
|
"SupportedCommands" : [ "MoveUp", "MoveUp" ],
|
|
"DeviceId" : "DeviceId",
|
|
"IsActive" : true,
|
|
"NowPlayingQueue" : [ {
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"Id" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
}, {
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"Id" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
} ],
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"ServerId" : "ServerId",
|
|
"RemoteEndPoint" : "RemoteEndPoint",
|
|
"SupportsRemoteControl" : true,
|
|
"HasCustomDeviceName" : true,
|
|
"Client" : "Client",
|
|
"UserName" : "UserName",
|
|
"FullNowPlayingItem" : "",
|
|
"SupportsMediaControl" : true,
|
|
"UserPrimaryImageTag" : "UserPrimaryImageTag",
|
|
"DeviceType" : "DeviceType",
|
|
"PlayableMediaTypes" : [ "PlayableMediaTypes", "PlayableMediaTypes" ],
|
|
"LastPlaybackCheckIn" : "2000-01-23T04:56:07.000+00:00",
|
|
"NowPlayingItem" : "",
|
|
"TranscodingInfo" : "",
|
|
"Capabilities" : "",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
|
|
"LastActivityDate" : "2000-01-23T04:56:07.000+00:00",
|
|
"Id" : "Id",
|
|
"AdditionalUsers" : [ {
|
|
"UserName" : "UserName",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
}, {
|
|
"UserName" : "UserName",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
} ],
|
|
"PlayState" : "",
|
|
"NowViewingItem" : "",
|
|
"DeviceName" : "DeviceName"
|
|
}, {
|
|
"ApplicationVersion" : "ApplicationVersion",
|
|
"SupportedCommands" : [ "MoveUp", "MoveUp" ],
|
|
"DeviceId" : "DeviceId",
|
|
"IsActive" : true,
|
|
"NowPlayingQueue" : [ {
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"Id" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
}, {
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"Id" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
} ],
|
|
"PlaylistItemId" : "PlaylistItemId",
|
|
"ServerId" : "ServerId",
|
|
"RemoteEndPoint" : "RemoteEndPoint",
|
|
"SupportsRemoteControl" : true,
|
|
"HasCustomDeviceName" : true,
|
|
"Client" : "Client",
|
|
"UserName" : "UserName",
|
|
"FullNowPlayingItem" : "",
|
|
"SupportsMediaControl" : true,
|
|
"UserPrimaryImageTag" : "UserPrimaryImageTag",
|
|
"DeviceType" : "DeviceType",
|
|
"PlayableMediaTypes" : [ "PlayableMediaTypes", "PlayableMediaTypes" ],
|
|
"LastPlaybackCheckIn" : "2000-01-23T04:56:07.000+00:00",
|
|
"NowPlayingItem" : "",
|
|
"TranscodingInfo" : "",
|
|
"Capabilities" : "",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
|
|
"LastActivityDate" : "2000-01-23T04:56:07.000+00:00",
|
|
"Id" : "Id",
|
|
"AdditionalUsers" : [ {
|
|
"UserName" : "UserName",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
}, {
|
|
"UserName" : "UserName",
|
|
"UserId" : "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
|
} ],
|
|
"PlayState" : "",
|
|
"NowViewingItem" : "",
|
|
"DeviceName" : "DeviceName"
|
|
} ]}]
|
|
- parameter controllableByUserId: (query) Filter by sessions that a given user is allowed to remote control. (optional)
|
|
- parameter deviceId: (query) Filter by device Id. (optional)
|
|
- parameter activeWithinSeconds: (query) Optional. Filter by sessions that were active in the last n seconds. (optional)
|
|
|
|
- returns: RequestBuilder<[SessionInfo]>
|
|
*/
|
|
open class func getSessionsWithRequestBuilder(controllableByUserId: UUID? = nil, deviceId: String? = nil, activeWithinSeconds: Int? = nil) -> RequestBuilder<[SessionInfo]> {
|
|
let path = "/Sessions"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"controllableByUserId": controllableByUserId,
|
|
"deviceId": deviceId,
|
|
"activeWithinSeconds": activeWithinSeconds?.encodeToJSON()
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[SessionInfo]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Instructs a session to play an item.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter playCommand: (query) The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.
|
|
- parameter itemIds: (query) The ids of the items to play, comma delimited.
|
|
- parameter startPositionTicks: (query) The starting position of the first item. (optional)
|
|
- parameter mediaSourceId: (query) Optional. The media source id. (optional)
|
|
- parameter audioStreamIndex: (query) Optional. The index of the audio stream to play. (optional)
|
|
- parameter subtitleStreamIndex: (query) Optional. The index of the subtitle stream to play. (optional)
|
|
- parameter startIndex: (query) Optional. The start index. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func play(sessionId: String, playCommand: PlayCommand, itemIds: [UUID], startPositionTicks: Int64? = nil, mediaSourceId: String? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, startIndex: Int? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
playWithRequestBuilder(sessionId: sessionId, playCommand: playCommand, itemIds: itemIds, startPositionTicks: startPositionTicks, mediaSourceId: mediaSourceId, audioStreamIndex: audioStreamIndex, subtitleStreamIndex: subtitleStreamIndex, startIndex: startIndex).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Instructs a session to play an item.
|
|
- POST /Sessions/{sessionId}/Playing
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter playCommand: (query) The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.
|
|
- parameter itemIds: (query) The ids of the items to play, comma delimited.
|
|
- parameter startPositionTicks: (query) The starting position of the first item. (optional)
|
|
- parameter mediaSourceId: (query) Optional. The media source id. (optional)
|
|
- parameter audioStreamIndex: (query) Optional. The index of the audio stream to play. (optional)
|
|
- parameter subtitleStreamIndex: (query) Optional. The index of the subtitle stream to play. (optional)
|
|
- parameter startIndex: (query) Optional. The start index. (optional)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func playWithRequestBuilder(sessionId: String, playCommand: PlayCommand, itemIds: [UUID], startPositionTicks: Int64? = nil, mediaSourceId: String? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, startIndex: Int? = nil) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Playing"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"playCommand": playCommand,
|
|
"itemIds": itemIds,
|
|
"startPositionTicks": startPositionTicks?.encodeToJSON(),
|
|
"mediaSourceId": mediaSourceId,
|
|
"audioStreamIndex": audioStreamIndex?.encodeToJSON(),
|
|
"subtitleStreamIndex": subtitleStreamIndex?.encodeToJSON(),
|
|
"startIndex": startIndex?.encodeToJSON()
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Updates capabilities for a device.
|
|
|
|
- parameter _id: (query) The session id. (optional)
|
|
- parameter playableMediaTypes: (query) A list of playable media types, comma delimited. Audio, Video, Book, Photo. (optional)
|
|
- parameter supportedCommands: (query) A list of supported remote control commands, comma delimited. (optional)
|
|
- parameter supportsMediaControl: (query) Determines whether media can be played remotely.. (optional, default to false)
|
|
- parameter supportsSync: (query) Determines whether sync is supported. (optional, default to false)
|
|
- parameter supportsPersistentIdentifier: (query) Determines whether the device supports a unique identifier. (optional, default to true)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func postCapabilities(_id: String? = nil, playableMediaTypes: [String]? = nil, supportedCommands: [GeneralCommandType]? = nil, supportsMediaControl: Bool? = nil, supportsSync: Bool? = nil, supportsPersistentIdentifier: Bool? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
postCapabilitiesWithRequestBuilder(_id: _id, playableMediaTypes: playableMediaTypes, supportedCommands: supportedCommands, supportsMediaControl: supportsMediaControl, supportsSync: supportsSync, supportsPersistentIdentifier: supportsPersistentIdentifier).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Updates capabilities for a device.
|
|
- POST /Sessions/Capabilities
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter _id: (query) The session id. (optional)
|
|
- parameter playableMediaTypes: (query) A list of playable media types, comma delimited. Audio, Video, Book, Photo. (optional)
|
|
- parameter supportedCommands: (query) A list of supported remote control commands, comma delimited. (optional)
|
|
- parameter supportsMediaControl: (query) Determines whether media can be played remotely.. (optional, default to false)
|
|
- parameter supportsSync: (query) Determines whether sync is supported. (optional, default to false)
|
|
- parameter supportsPersistentIdentifier: (query) Determines whether the device supports a unique identifier. (optional, default to true)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func postCapabilitiesWithRequestBuilder(_id: String? = nil, playableMediaTypes: [String]? = nil, supportedCommands: [GeneralCommandType]? = nil, supportsMediaControl: Bool? = nil, supportsSync: Bool? = nil, supportsPersistentIdentifier: Bool? = nil) -> RequestBuilder<Void> {
|
|
let path = "/Sessions/Capabilities"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"id": _id,
|
|
"playableMediaTypes": playableMediaTypes,
|
|
"supportedCommands": supportedCommands,
|
|
"supportsMediaControl": supportsMediaControl,
|
|
"supportsSync": supportsSync,
|
|
"supportsPersistentIdentifier": supportsPersistentIdentifier
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Updates capabilities for a device.
|
|
|
|
- parameter body: (body) The MediaBrowser.Model.Session.ClientCapabilities.
|
|
- parameter _id: (query) The session id. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func postFullCapabilities(body: CapabilitiesFullBody, _id: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
postFullCapabilitiesWithRequestBuilder(body: body, _id: _id).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Updates capabilities for a device.
|
|
- POST /Sessions/Capabilities/Full
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) The MediaBrowser.Model.Session.ClientCapabilities.
|
|
- parameter _id: (query) The session id. (optional)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func postFullCapabilitiesWithRequestBuilder(body: CapabilitiesFullBody, _id: String? = nil) -> RequestBuilder<Void> {
|
|
let path = "/Sessions/Capabilities/Full"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"id": _id
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
|
}
|
|
/**
|
|
Removes an additional user from a session.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter userId: (path) The user id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func removeUserFromSession(sessionId: String, userId: UUID, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
removeUserFromSessionWithRequestBuilder(sessionId: sessionId, userId: userId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Removes an additional user from a session.
|
|
- DELETE /Sessions/{sessionId}/User/{userId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter userId: (path) The user id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func removeUserFromSessionWithRequestBuilder(sessionId: String, userId: UUID) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/User/{userId}"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, 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)
|
|
}
|
|
/**
|
|
Reports that a session has ended.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func reportSessionEnded(completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
reportSessionEndedWithRequestBuilder().execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Reports that a session has ended.
|
|
- POST /Sessions/Logout
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func reportSessionEndedWithRequestBuilder() -> RequestBuilder<Void> {
|
|
let path = "/Sessions/Logout"
|
|
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)
|
|
}
|
|
/**
|
|
Reports that a session is viewing an item.
|
|
|
|
- parameter itemId: (query) The item id.
|
|
- parameter sessionId: (query) The session id. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func reportViewing(itemId: String, sessionId: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
reportViewingWithRequestBuilder(itemId: itemId, sessionId: sessionId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Reports that a session is viewing an item.
|
|
- POST /Sessions/Viewing
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter itemId: (query) The item id.
|
|
- parameter sessionId: (query) The session id. (optional)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func reportViewingWithRequestBuilder(itemId: String, sessionId: String? = nil) -> RequestBuilder<Void> {
|
|
let path = "/Sessions/Viewing"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"sessionId": sessionId,
|
|
"itemId": itemId
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Issues a full general command to a client.
|
|
|
|
- parameter body: (body) The MediaBrowser.Model.Session.GeneralCommand.
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func sendFullGeneralCommand(body: SessionIdCommandBody, sessionId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
sendFullGeneralCommandWithRequestBuilder(body: body, sessionId: sessionId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Issues a full general command to a client.
|
|
- POST /Sessions/{sessionId}/Command
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) The MediaBrowser.Model.Session.GeneralCommand.
|
|
- parameter sessionId: (path) The session id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func sendFullGeneralCommandWithRequestBuilder(body: SessionIdCommandBody, sessionId: String) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Command"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, 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)
|
|
}
|
|
/**
|
|
Issues a general command to a client.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The command to send.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func sendGeneralCommand(sessionId: String, command: Command, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
sendGeneralCommandWithRequestBuilder(sessionId: sessionId, command: command).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Issues a general command to a client.
|
|
- POST /Sessions/{sessionId}/Command/{command}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The command to send.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func sendGeneralCommandWithRequestBuilder(sessionId: String, command: Command) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Command/{command}"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let commandPreEscape = "\(command)"
|
|
let commandPostEscape = commandPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{command}", with: commandPostEscape, 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)
|
|
}
|
|
/**
|
|
Issues a command to a client to display a message to the user.
|
|
|
|
- parameter body: (body) The MediaBrowser.Model.Session.MessageCommand object containing Header, Message Text, and TimeoutMs.
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func sendMessageCommand(body: SessionIdMessageBody, sessionId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
sendMessageCommandWithRequestBuilder(body: body, sessionId: sessionId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Issues a command to a client to display a message to the user.
|
|
- POST /Sessions/{sessionId}/Message
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) The MediaBrowser.Model.Session.MessageCommand object containing Header, Message Text, and TimeoutMs.
|
|
- parameter sessionId: (path) The session id.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func sendMessageCommandWithRequestBuilder(body: SessionIdMessageBody, sessionId: String) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Message"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, 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)
|
|
}
|
|
/**
|
|
Issues a playstate command to a client.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The MediaBrowser.Model.Session.PlaystateCommand.
|
|
- parameter seekPositionTicks: (query) The optional position ticks. (optional)
|
|
- parameter controllingUserId: (query) The optional controlling user id. (optional)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func sendPlaystateCommand(sessionId: String, command: Command1, seekPositionTicks: Int64? = nil, controllingUserId: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
sendPlaystateCommandWithRequestBuilder(sessionId: sessionId, command: command, seekPositionTicks: seekPositionTicks, controllingUserId: controllingUserId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Issues a playstate command to a client.
|
|
- POST /Sessions/{sessionId}/Playing/{command}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The MediaBrowser.Model.Session.PlaystateCommand.
|
|
- parameter seekPositionTicks: (query) The optional position ticks. (optional)
|
|
- parameter controllingUserId: (query) The optional controlling user id. (optional)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func sendPlaystateCommandWithRequestBuilder(sessionId: String, command: Command1, seekPositionTicks: Int64? = nil, controllingUserId: String? = nil) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/Playing/{command}"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let commandPreEscape = "\(command)"
|
|
let commandPostEscape = commandPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{command}", with: commandPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
var url = URLComponents(string: URLString)
|
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"seekPositionTicks": seekPositionTicks?.encodeToJSON(),
|
|
"controllingUserId": controllingUserId
|
|
])
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Issues a system command to a client.
|
|
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The command to send.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func sendSystemCommand(sessionId: String, command: Command2, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
sendSystemCommandWithRequestBuilder(sessionId: sessionId, command: command).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Issues a system command to a client.
|
|
- POST /Sessions/{sessionId}/System/{command}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter sessionId: (path) The session id.
|
|
- parameter command: (path) The command to send.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func sendSystemCommandWithRequestBuilder(sessionId: String, command: Command2) -> RequestBuilder<Void> {
|
|
var path = "/Sessions/{sessionId}/System/{command}"
|
|
let sessionIdPreEscape = "\(sessionId)"
|
|
let sessionIdPostEscape = sessionIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{sessionId}", with: sessionIdPostEscape, options: .literal, range: nil)
|
|
let commandPreEscape = "\(command)"
|
|
let commandPostEscape = commandPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{command}", with: commandPostEscape, 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)
|
|
}
|
|
}
|