-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into migrate-on-disconnect
- Loading branch information
Showing
22 changed files
with
319 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import com.vanniktech.maven.publish.JavadocJar | ||
import com.vanniktech.maven.publish.KotlinMultiplatform | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
`lavalink-module` | ||
`lavalink-publishing` | ||
kotlin("plugin.serialization") | ||
alias(libs.plugins.ksp) | ||
} | ||
|
||
kotlin { | ||
jvm { | ||
compilations.all { | ||
compilerOptions.configure { | ||
jvmTarget = JvmTarget.JVM_11 | ||
} | ||
} | ||
} | ||
sourceSets { | ||
all { | ||
languageSettings.optIn("kotlin.contracts.ExperimentalContracts") | ||
languageSettings.optIn("dev.schlaubi.lavakord.PluginApi") | ||
languageSettings.optIn("dev.schlaubi.lavakord.UnsafeRestApi") | ||
} | ||
commonMain { | ||
kotlin.srcDir(layout.buildDirectory.dir("generated/ksp/metadata/commonMain/kotlin")) | ||
dependencies { | ||
api(projects.core) | ||
api(libs.lavasearch.protocol) | ||
|
||
implementation(libs.ktor.client.resources) | ||
implementation(libs.kord.ksp.annotations) | ||
} | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
kspCommonMainMetadata(libs.kord.ksp.processors) | ||
} | ||
|
||
tasks { | ||
listOf("sourcesJar", "jsSourcesJar", "jvmSourcesJar", "compileKotlinJs", "compileKotlinJvm", "dokkaHtml").forEach { | ||
named(it) { | ||
dependsOn("kspCommonMainKotlinMetadata") | ||
} | ||
} | ||
} | ||
|
||
mavenPublishing { | ||
configure(KotlinMultiplatform(JavadocJar.Dokka("dokkaHtml"))) | ||
} |
97 changes: 97 additions & 0 deletions
97
...p/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasearch/model/SearchType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// THIS FILE IS AUTO-GENERATED BY KordEnumProcessor.kt, DO NOT EDIT! | ||
@file:Suppress(names = arrayOf("RedundantVisibilityModifier", "IncorrectFormatting", | ||
"ReplaceArrayOfWithLiteral", "SpellCheckingInspection", "GrazieInspection")) | ||
|
||
package dev.schlaubi.lavakord.plugins.lavasearch.model | ||
|
||
import kotlin.Any | ||
import kotlin.Boolean | ||
import kotlin.Int | ||
import kotlin.LazyThreadSafetyMode.PUBLICATION | ||
import kotlin.String | ||
import kotlin.Suppress | ||
import kotlin.collections.List | ||
import kotlinx.serialization.KSerializer | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.descriptors.PrimitiveKind | ||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | ||
import kotlinx.serialization.descriptors.SerialDescriptor | ||
import kotlinx.serialization.encoding.Decoder | ||
import kotlinx.serialization.encoding.Encoder | ||
|
||
/** | ||
* See [SearchType]s in the | ||
* [Discord Developer Documentation](https://github.com/topi314/LavaSearch?tab=readme-ov-file#api). | ||
*/ | ||
@Serializable(with = SearchType.Serializer::class) | ||
public sealed class SearchType( | ||
/** | ||
* The raw value used by Discord. | ||
*/ | ||
public val `value`: String, | ||
) { | ||
public final override fun equals(other: Any?): Boolean = this === other || | ||
(other is SearchType && this.value == other.value) | ||
|
||
public final override fun hashCode(): Int = value.hashCode() | ||
|
||
public final override fun toString(): String = | ||
"SearchType.${this::class.simpleName}(value=$value)" | ||
|
||
/** | ||
* An unknown [SearchType]. | ||
* | ||
* This is used as a fallback for [SearchType]s that haven't been added to Kord yet. | ||
*/ | ||
public class Unknown( | ||
`value`: String, | ||
) : SearchType(value) | ||
|
||
public object Track : SearchType("track") | ||
|
||
public object Album : SearchType("album") | ||
|
||
public object Artist : SearchType("artist") | ||
|
||
public object Playlist : SearchType("playlist") | ||
|
||
/** | ||
* Search suggestions | ||
*/ | ||
public object Text : SearchType("text") | ||
|
||
internal object Serializer : KSerializer<SearchType> { | ||
public override val descriptor: SerialDescriptor = | ||
PrimitiveSerialDescriptor("dev.schlaubi.lavakord.plugins.lavasearch.model.SearchType", | ||
PrimitiveKind.STRING) | ||
|
||
public override fun serialize(encoder: Encoder, `value`: SearchType) = | ||
encoder.encodeString(value.value) | ||
|
||
public override fun deserialize(decoder: Decoder) = | ||
when (val value = decoder.decodeString()) { | ||
"track" -> Track | ||
"album" -> Album | ||
"artist" -> Artist | ||
"playlist" -> Playlist | ||
"text" -> Text | ||
else -> Unknown(value) | ||
} | ||
} | ||
|
||
public companion object { | ||
/** | ||
* A [List] of all known [SearchType]s. | ||
*/ | ||
public val entries: List<SearchType> by lazy(mode = PUBLICATION) { | ||
listOf( | ||
Track, | ||
Album, | ||
Artist, | ||
Playlist, | ||
Text, | ||
) | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.