commonMain.org.jellyfin.sdk.api.operations.PlayStateApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jellyfin-api-jvm Show documentation
Show all versions of jellyfin-api-jvm Show documentation
Official Kotlin/Java SDK for Jellyfin. org.jellyfin.sdk:jellyfin-api-jvm
// !! WARNING
// !! DO NOT EDIT THIS FILE
//
// This file is generated by the openapi-generator module and is not meant for manual changes.
// Please read the README.md file in the openapi-generator module for additional information.
package org.jellyfin.sdk.api.operations
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Unit
import kotlin.collections.buildMap
import kotlin.collections.emptyMap
import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.Response
import org.jellyfin.sdk.api.client.extensions.delete
import org.jellyfin.sdk.api.client.extensions.post
import org.jellyfin.sdk.model.DateTime
import org.jellyfin.sdk.model.UUID
import org.jellyfin.sdk.model.api.PlayMethod
import org.jellyfin.sdk.model.api.PlaybackProgressInfo
import org.jellyfin.sdk.model.api.PlaybackStartInfo
import org.jellyfin.sdk.model.api.PlaybackStopInfo
import org.jellyfin.sdk.model.api.RepeatMode
import org.jellyfin.sdk.model.api.UserItemDataDto
import org.jellyfin.sdk.model.api.request.OnPlaybackProgressRequest
import org.jellyfin.sdk.model.api.request.OnPlaybackStartRequest
import org.jellyfin.sdk.model.api.request.OnPlaybackStoppedRequest
public class PlayStateApi(
private val api: ApiClient,
) : Api {
/**
* Marks an item as played for user.
*
* @param itemId Item id.
* @param userId User id.
* @param datePlayed Optional. The date the item was played.
*/
public suspend fun markPlayedItem(
itemId: UUID,
userId: UUID? = null,
datePlayed: DateTime? = null,
): Response {
val pathParameters = buildMap(1) {
put("itemId", itemId)
}
val queryParameters = buildMap(2) {
put("userId", userId)
put("datePlayed", datePlayed)
}
val data = null
val response = api.post("/UserPlayedItems/{itemId}", pathParameters,
queryParameters, data)
return response
}
/**
* Marks an item as unplayed for user.
*
* @param itemId Item id.
* @param userId User id.
*/
public suspend fun markUnplayedItem(itemId: UUID, userId: UUID? = null):
Response {
val pathParameters = buildMap(1) {
put("itemId", itemId)
}
val queryParameters = buildMap(1) {
put("userId", userId)
}
val data = null
val response = api.delete("/UserPlayedItems/{itemId}", pathParameters,
queryParameters, data)
return response
}
/**
* Reports a session's playback progress.
*
* @param itemId Item id.
* @param mediaSourceId The id of the MediaSource.
* @param positionTicks Optional. The current position, in ticks. 1 tick = 10000 ms.
* @param audioStreamIndex The audio stream index.
* @param subtitleStreamIndex The subtitle stream index.
* @param volumeLevel Scale of 0-100.
* @param playMethod The play method.
* @param liveStreamId The live stream id.
* @param playSessionId The play session id.
* @param repeatMode The repeat mode.
* @param isPaused Indicates if the player is paused.
* @param isMuted Indicates if the player is muted.
*/
public suspend fun onPlaybackProgress(
itemId: UUID,
mediaSourceId: String? = null,
positionTicks: Long? = null,
audioStreamIndex: Int? = null,
subtitleStreamIndex: Int? = null,
volumeLevel: Int? = null,
playMethod: PlayMethod? = null,
liveStreamId: String? = null,
playSessionId: String? = null,
repeatMode: RepeatMode? = null,
isPaused: Boolean? = false,
isMuted: Boolean? = false,
): Response {
val pathParameters = buildMap(1) {
put("itemId", itemId)
}
val queryParameters = buildMap(11) {
put("mediaSourceId", mediaSourceId)
put("positionTicks", positionTicks)
put("audioStreamIndex", audioStreamIndex)
put("subtitleStreamIndex", subtitleStreamIndex)
put("volumeLevel", volumeLevel)
put("playMethod", playMethod)
put("liveStreamId", liveStreamId)
put("playSessionId", playSessionId)
put("repeatMode", repeatMode)
put("isPaused", isPaused)
put("isMuted", isMuted)
}
val data = null
val response = api.post("/PlayingItems/{itemId}/Progress", pathParameters, queryParameters,
data)
return response
}
/**
* Reports a session's playback progress.
*
* @param request The request parameters
*/
public suspend fun onPlaybackProgress(request: OnPlaybackProgressRequest): Response =
onPlaybackProgress(
itemId = request.itemId,
mediaSourceId = request.mediaSourceId,
positionTicks = request.positionTicks,
audioStreamIndex = request.audioStreamIndex,
subtitleStreamIndex = request.subtitleStreamIndex,
volumeLevel = request.volumeLevel,
playMethod = request.playMethod,
liveStreamId = request.liveStreamId,
playSessionId = request.playSessionId,
repeatMode = request.repeatMode,
isPaused = request.isPaused,
isMuted = request.isMuted,
)
/**
* Reports that a session has begun playing an item.
*
* @param itemId Item id.
* @param mediaSourceId The id of the MediaSource.
* @param audioStreamIndex The audio stream index.
* @param subtitleStreamIndex The subtitle stream index.
* @param playMethod The play method.
* @param liveStreamId The live stream id.
* @param playSessionId The play session id.
* @param canSeek Indicates if the client can seek.
*/
public suspend fun onPlaybackStart(
itemId: UUID,
mediaSourceId: String? = null,
audioStreamIndex: Int? = null,
subtitleStreamIndex: Int? = null,
playMethod: PlayMethod? = null,
liveStreamId: String? = null,
playSessionId: String? = null,
canSeek: Boolean? = false,
): Response {
val pathParameters = buildMap(1) {
put("itemId", itemId)
}
val queryParameters = buildMap(7) {
put("mediaSourceId", mediaSourceId)
put("audioStreamIndex", audioStreamIndex)
put("subtitleStreamIndex", subtitleStreamIndex)
put("playMethod", playMethod)
put("liveStreamId", liveStreamId)
put("playSessionId", playSessionId)
put("canSeek", canSeek)
}
val data = null
val response = api.post("/PlayingItems/{itemId}", pathParameters, queryParameters, data)
return response
}
/**
* Reports that a session has begun playing an item.
*
* @param request The request parameters
*/
public suspend fun onPlaybackStart(request: OnPlaybackStartRequest): Response =
onPlaybackStart(
itemId = request.itemId,
mediaSourceId = request.mediaSourceId,
audioStreamIndex = request.audioStreamIndex,
subtitleStreamIndex = request.subtitleStreamIndex,
playMethod = request.playMethod,
liveStreamId = request.liveStreamId,
playSessionId = request.playSessionId,
canSeek = request.canSeek,
)
/**
* Reports that a session has stopped playing an item.
*
* @param itemId Item id.
* @param mediaSourceId The id of the MediaSource.
* @param nextMediaType The next media type that will play.
* @param positionTicks Optional. The position, in ticks, where playback stopped. 1 tick = 10000
* ms.
* @param liveStreamId The live stream id.
* @param playSessionId The play session id.
*/
public suspend fun onPlaybackStopped(
itemId: UUID,
mediaSourceId: String? = null,
nextMediaType: String? = null,
positionTicks: Long? = null,
liveStreamId: String? = null,
playSessionId: String? = null,
): Response {
val pathParameters = buildMap(1) {
put("itemId", itemId)
}
val queryParameters = buildMap(5) {
put("mediaSourceId", mediaSourceId)
put("nextMediaType", nextMediaType)
put("positionTicks", positionTicks)
put("liveStreamId", liveStreamId)
put("playSessionId", playSessionId)
}
val data = null
val response = api.delete("/PlayingItems/{itemId}", pathParameters, queryParameters, data)
return response
}
/**
* Reports that a session has stopped playing an item.
*
* @param request The request parameters
*/
public suspend fun onPlaybackStopped(request: OnPlaybackStoppedRequest): Response =
onPlaybackStopped(
itemId = request.itemId,
mediaSourceId = request.mediaSourceId,
nextMediaType = request.nextMediaType,
positionTicks = request.positionTicks,
liveStreamId = request.liveStreamId,
playSessionId = request.playSessionId,
)
/**
* Pings a playback session.
*
* @param playSessionId Playback session id.
*/
public suspend fun pingPlaybackSession(playSessionId: String): Response {
val pathParameters = emptyMap()
val queryParameters = buildMap(1) {
put("playSessionId", playSessionId)
}
val data = null
val response = api.post("/Sessions/Playing/Ping", pathParameters, queryParameters, data)
return response
}
/**
* Reports playback progress within a session.
*/
public suspend fun reportPlaybackProgress(`data`: PlaybackProgressInfo? = null): Response {
val pathParameters = emptyMap()
val queryParameters = emptyMap()
val response = api.post("/Sessions/Playing/Progress", pathParameters, queryParameters, data)
return response
}
/**
* Reports playback has started within a session.
*/
public suspend fun reportPlaybackStart(`data`: PlaybackStartInfo? = null): Response {
val pathParameters = emptyMap()
val queryParameters = emptyMap()
val response = api.post("/Sessions/Playing", pathParameters, queryParameters, data)
return response
}
/**
* Reports playback has stopped within a session.
*/
public suspend fun reportPlaybackStopped(`data`: PlaybackStopInfo? = null): Response {
val pathParameters = emptyMap()
val queryParameters = emptyMap()
val response = api.post("/Sessions/Playing/Stopped", pathParameters, queryParameters, data)
return response
}
}