commonMain.rest.Rest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lavasearch-jvm Show documentation
Show all versions of lavasearch-jvm Show documentation
Coroutine based client for Lavalink (Kotlin and Java)
package dev.schlaubi.lavakord.plugins.lavasearch.rest
import com.github.topi314.lavasearch.protocol.SearchResult
import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.audio.Node
import dev.schlaubi.lavakord.plugins.lavasearch.model.SearchType
import dev.schlaubi.lavakord.rest.get
/**
* Searches for [query].
*
* @param types the allowed [SearchTypes][SearchType]
* @see SearchResult
*/
public suspend fun Node.search(query: String, vararg types: SearchType): SearchResult =
search(query, types.asIterable())
/**
* Searches for [query].
*
* @param types the allowed [SearchTypes][SearchType]
* @see SearchResult
*/
public suspend fun Node.search(query: String, types: Iterable): SearchResult =
get(LavaSearchRoute(query, types.toList()))
/**
* Searches for [query].
*
* @param types the allowed [SearchTypes][SearchType]
* @see SearchResult
*/
public suspend fun Link.search(query: String, vararg types: SearchType): SearchResult = node.search(query, *types)
/**
* Searches for [query].
*
* @param types the allowed [SearchTypes][SearchType]
* @see SearchResult
*/
public suspend fun Link.search(query: String, types: Iterable): SearchResult = node.search(query, types)