All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.jellyfin.sdk.api.operations.CollectionApi.kt Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
// !!        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.String
import kotlin.Unit
import kotlin.collections.Collection
import kotlin.collections.buildMap
import kotlin.collections.emptyList
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.UUID
import org.jellyfin.sdk.model.api.CollectionCreationResult

public class CollectionApi(
	private val api: ApiClient,
) : Api {
	/**
	 * Adds items to a collection.
	 *
	 * @param collectionId The collection id.
	 * @param ids Item ids, comma delimited.
	 */
	public suspend fun addToCollection(collectionId: UUID, ids: Collection = emptyList()):
			Response {
		val pathParameters = buildMap(1) {
			put("collectionId", collectionId)
		}
		val queryParameters = buildMap(1) {
			put("ids", ids)
		}
		val data = null
		val response = api.post("/Collections/{collectionId}/Items", pathParameters,
				queryParameters, data)
		return response
	}

	/**
	 * Creates a new collection.
	 *
	 * @param name The name of the collection.
	 * @param ids Item Ids to add to the collection.
	 * @param parentId Optional. Create the collection within a specific folder.
	 * @param isLocked Whether or not to lock the new collection.
	 */
	public suspend fun createCollection(
		name: String? = null,
		ids: Collection? = emptyList(),
		parentId: UUID? = null,
		isLocked: Boolean? = false,
	): Response {
		val pathParameters = emptyMap()
		val queryParameters = buildMap(4) {
			put("name", name)
			put("ids", ids)
			put("parentId", parentId)
			put("isLocked", isLocked)
		}
		val data = null
		val response = api.post("/Collections", pathParameters, queryParameters,
				data)
		return response
	}

	/**
	 * Removes items from a collection.
	 *
	 * @param collectionId The collection id.
	 * @param ids Item ids, comma delimited.
	 */
	public suspend fun removeFromCollection(collectionId: UUID, ids: Collection = emptyList()):
			Response {
		val pathParameters = buildMap(1) {
			put("collectionId", collectionId)
		}
		val queryParameters = buildMap(1) {
			put("ids", ids)
		}
		val data = null
		val response = api.delete("/Collections/{collectionId}/Items", pathParameters,
				queryParameters, data)
		return response
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy