// // PlaystateAPI.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation import Alamofire open class PlaystateAPI { /** Marks an item as played for user. - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter datePlayed: (query) Optional. The date the item was played. (optional) - parameter completion: completion handler to receive the data and the error objects */ open class func markPlayedItem(userId: UUID, itemId: UUID, datePlayed: Date? = nil, completion: @escaping ((_ data: UserItemDataDto?,_ error: Error?) -> Void)) { markPlayedItemWithRequestBuilder(userId: userId, itemId: itemId, datePlayed: datePlayed).execute { (response, error) -> Void in completion(response?.body, error) } } /** Marks an item as played for user. - POST /Users/{userId}/PlayedItems/{itemId} - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - examples: [{contentType=application/json, example={ "UnplayedItemCount" : 1, "Played" : true, "PlayedPercentage" : 6.027456183070403, "Rating" : 0.8008281904610115, "PlayCount" : 5, "PlaybackPositionTicks" : 5, "LastPlayedDate" : "2000-01-23T04:56:07.000+00:00", "Likes" : true, "IsFavorite" : true, "ItemId" : "ItemId", "Key" : "Key" }}] - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter datePlayed: (query) Optional. The date the item was played. (optional) - returns: RequestBuilder */ open class func markPlayedItemWithRequestBuilder(userId: UUID, itemId: UUID, datePlayed: Date? = nil) -> RequestBuilder { var path = "/Users/{userId}/PlayedItems/{itemId}" let userIdPreEscape = "\(userId)" let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil) let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "datePlayed": datePlayed?.encodeToJSON() ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Marks an item as unplayed for user. - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter completion: completion handler to receive the data and the error objects */ open class func markUnplayedItem(userId: UUID, itemId: UUID, completion: @escaping ((_ data: UserItemDataDto?,_ error: Error?) -> Void)) { markUnplayedItemWithRequestBuilder(userId: userId, itemId: itemId).execute { (response, error) -> Void in completion(response?.body, error) } } /** Marks an item as unplayed for user. - DELETE /Users/{userId}/PlayedItems/{itemId} - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - examples: [{contentType=application/json, example={ "UnplayedItemCount" : 1, "Played" : true, "PlayedPercentage" : 6.027456183070403, "Rating" : 0.8008281904610115, "PlayCount" : 5, "PlaybackPositionTicks" : 5, "LastPlayedDate" : "2000-01-23T04:56:07.000+00:00", "Likes" : true, "IsFavorite" : true, "ItemId" : "ItemId", "Key" : "Key" }}] - parameter userId: (path) User id. - parameter itemId: (path) Item id. - returns: RequestBuilder */ open class func markUnplayedItemWithRequestBuilder(userId: UUID, itemId: UUID) -> RequestBuilder { var path = "/Users/{userId}/PlayedItems/{itemId}" let userIdPreEscape = "\(userId)" let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil) let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Reports a user's playback progress. - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter positionTicks: (query) Optional. The current position, in ticks. 1 tick = 10000 ms. (optional) - parameter audioStreamIndex: (query) The audio stream index. (optional) - parameter subtitleStreamIndex: (query) The subtitle stream index. (optional) - parameter volumeLevel: (query) Scale of 0-100. (optional) - parameter playMethod: (query) The play method. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - parameter repeatMode: (query) The repeat mode. (optional) - parameter isPaused: (query) Indicates if the player is paused. (optional, default to false) - parameter isMuted: (query) Indicates if the player is muted. (optional, default to false) - parameter completion: completion handler to receive the data and the error objects */ open class func onPlaybackProgress(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, positionTicks: Int64? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, volumeLevel: Int? = nil, playMethod: PlayMethod1? = nil, liveStreamId: String? = nil, playSessionId: String? = nil, repeatMode: RepeatMode? = nil, isPaused: Bool? = nil, isMuted: Bool? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { onPlaybackProgressWithRequestBuilder(userId: userId, itemId: itemId, mediaSourceId: mediaSourceId, positionTicks: positionTicks, audioStreamIndex: audioStreamIndex, subtitleStreamIndex: subtitleStreamIndex, volumeLevel: volumeLevel, playMethod: playMethod, liveStreamId: liveStreamId, playSessionId: playSessionId, repeatMode: repeatMode, isPaused: isPaused, isMuted: isMuted).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports a user's playback progress. - POST /Users/{userId}/PlayingItems/{itemId}/Progress - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter positionTicks: (query) Optional. The current position, in ticks. 1 tick = 10000 ms. (optional) - parameter audioStreamIndex: (query) The audio stream index. (optional) - parameter subtitleStreamIndex: (query) The subtitle stream index. (optional) - parameter volumeLevel: (query) Scale of 0-100. (optional) - parameter playMethod: (query) The play method. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - parameter repeatMode: (query) The repeat mode. (optional) - parameter isPaused: (query) Indicates if the player is paused. (optional, default to false) - parameter isMuted: (query) Indicates if the player is muted. (optional, default to false) - returns: RequestBuilder */ open class func onPlaybackProgressWithRequestBuilder(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, positionTicks: Int64? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, volumeLevel: Int? = nil, playMethod: PlayMethod1? = nil, liveStreamId: String? = nil, playSessionId: String? = nil, repeatMode: RepeatMode? = nil, isPaused: Bool? = nil, isMuted: Bool? = nil) -> RequestBuilder { var path = "/Users/{userId}/PlayingItems/{itemId}/Progress" let userIdPreEscape = "\(userId)" let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil) let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "mediaSourceId": mediaSourceId, "positionTicks": positionTicks?.encodeToJSON(), "audioStreamIndex": audioStreamIndex?.encodeToJSON(), "subtitleStreamIndex": subtitleStreamIndex?.encodeToJSON(), "volumeLevel": volumeLevel?.encodeToJSON(), "playMethod": playMethod, "liveStreamId": liveStreamId, "playSessionId": playSessionId, "repeatMode": repeatMode, "isPaused": isPaused, "isMuted": isMuted ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Reports that a user has begun playing an item. - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter audioStreamIndex: (query) The audio stream index. (optional) - parameter subtitleStreamIndex: (query) The subtitle stream index. (optional) - parameter playMethod: (query) The play method. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - parameter canSeek: (query) Indicates if the client can seek. (optional, default to false) - parameter completion: completion handler to receive the data and the error objects */ open class func onPlaybackStart(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, playMethod: PlayMethod? = nil, liveStreamId: String? = nil, playSessionId: String? = nil, canSeek: Bool? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { onPlaybackStartWithRequestBuilder(userId: userId, itemId: itemId, mediaSourceId: mediaSourceId, audioStreamIndex: audioStreamIndex, subtitleStreamIndex: subtitleStreamIndex, playMethod: playMethod, liveStreamId: liveStreamId, playSessionId: playSessionId, canSeek: canSeek).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports that a user has begun playing an item. - POST /Users/{userId}/PlayingItems/{itemId} - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter audioStreamIndex: (query) The audio stream index. (optional) - parameter subtitleStreamIndex: (query) The subtitle stream index. (optional) - parameter playMethod: (query) The play method. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - parameter canSeek: (query) Indicates if the client can seek. (optional, default to false) - returns: RequestBuilder */ open class func onPlaybackStartWithRequestBuilder(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, audioStreamIndex: Int? = nil, subtitleStreamIndex: Int? = nil, playMethod: PlayMethod? = nil, liveStreamId: String? = nil, playSessionId: String? = nil, canSeek: Bool? = nil) -> RequestBuilder { var path = "/Users/{userId}/PlayingItems/{itemId}" let userIdPreEscape = "\(userId)" let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil) let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "mediaSourceId": mediaSourceId, "audioStreamIndex": audioStreamIndex?.encodeToJSON(), "subtitleStreamIndex": subtitleStreamIndex?.encodeToJSON(), "playMethod": playMethod, "liveStreamId": liveStreamId, "playSessionId": playSessionId, "canSeek": canSeek ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Reports that a user has stopped playing an item. - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter nextMediaType: (query) The next media type that will play. (optional) - parameter positionTicks: (query) Optional. The position, in ticks, where playback stopped. 1 tick = 10000 ms. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - parameter completion: completion handler to receive the data and the error objects */ open class func onPlaybackStopped(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, nextMediaType: String? = nil, positionTicks: Int64? = nil, liveStreamId: String? = nil, playSessionId: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { onPlaybackStoppedWithRequestBuilder(userId: userId, itemId: itemId, mediaSourceId: mediaSourceId, nextMediaType: nextMediaType, positionTicks: positionTicks, liveStreamId: liveStreamId, playSessionId: playSessionId).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports that a user has stopped playing an item. - DELETE /Users/{userId}/PlayingItems/{itemId} - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter userId: (path) User id. - parameter itemId: (path) Item id. - parameter mediaSourceId: (query) The id of the MediaSource. (optional) - parameter nextMediaType: (query) The next media type that will play. (optional) - parameter positionTicks: (query) Optional. The position, in ticks, where playback stopped. 1 tick = 10000 ms. (optional) - parameter liveStreamId: (query) The live stream id. (optional) - parameter playSessionId: (query) The play session id. (optional) - returns: RequestBuilder */ open class func onPlaybackStoppedWithRequestBuilder(userId: UUID, itemId: UUID, mediaSourceId: String? = nil, nextMediaType: String? = nil, positionTicks: Int64? = nil, liveStreamId: String? = nil, playSessionId: String? = nil) -> RequestBuilder { var path = "/Users/{userId}/PlayingItems/{itemId}" let userIdPreEscape = "\(userId)" let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil) let itemIdPreEscape = "\(itemId)" let itemIdPostEscape = itemIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{itemId}", with: itemIdPostEscape, options: .literal, range: nil) let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "mediaSourceId": mediaSourceId, "nextMediaType": nextMediaType, "positionTicks": positionTicks?.encodeToJSON(), "liveStreamId": liveStreamId, "playSessionId": playSessionId ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Pings a playback session. - parameter playSessionId: (query) Playback session id. - parameter completion: completion handler to receive the data and the error objects */ open class func pingPlaybackSession(playSessionId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { pingPlaybackSessionWithRequestBuilder(playSessionId: playSessionId).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Pings a playback session. - POST /Sessions/Playing/Ping - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter playSessionId: (query) Playback session id. - returns: RequestBuilder */ open class func pingPlaybackSessionWithRequestBuilder(playSessionId: String) -> RequestBuilder { let path = "/Sessions/Playing/Ping" let URLString = SwaggerClientAPI.basePath + path let parameters: [String:Any]? = nil var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "playSessionId": playSessionId ]) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } /** Reports playback progress within a session. - parameter body: (body) The playback progress info. (optional) - parameter completion: completion handler to receive the data and the error objects */ open class func reportPlaybackProgress(body: PlayingProgressBody? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { reportPlaybackProgressWithRequestBuilder(body: body).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports playback progress within a session. - POST /Sessions/Playing/Progress - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter body: (body) The playback progress info. (optional) - returns: RequestBuilder */ open class func reportPlaybackProgressWithRequestBuilder(body: PlayingProgressBody? = nil) -> RequestBuilder { let path = "/Sessions/Playing/Progress" let URLString = SwaggerClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } /** Reports playback has started within a session. - parameter body: (body) The playback start info. (optional) - parameter completion: completion handler to receive the data and the error objects */ open class func reportPlaybackStart(body: SessionsPlayingBody? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { reportPlaybackStartWithRequestBuilder(body: body).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports playback has started within a session. - POST /Sessions/Playing - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter body: (body) The playback start info. (optional) - returns: RequestBuilder */ open class func reportPlaybackStartWithRequestBuilder(body: SessionsPlayingBody? = nil) -> RequestBuilder { let path = "/Sessions/Playing" let URLString = SwaggerClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } /** Reports playback has stopped within a session. - parameter body: (body) The playback stop info. (optional) - parameter completion: completion handler to receive the data and the error objects */ open class func reportPlaybackStopped(body: PlayingStoppedBody? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { reportPlaybackStoppedWithRequestBuilder(body: body).execute { (response, error) -> Void in if error == nil { completion((), error) } else { completion(nil, error) } } } /** Reports playback has stopped within a session. - POST /Sessions/Playing/Stopped - - API Key: - type: apiKey X-Emby-Authorization - name: CustomAuthentication - parameter body: (body) The playback stop info. (optional) - returns: RequestBuilder */ open class func reportPlaybackStoppedWithRequestBuilder(body: PlayingStoppedBody? = nil) -> RequestBuilder { let path = "/Sessions/Playing/Stopped" let URLString = SwaggerClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder() return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } }