-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d22f886
commit 28ffaaa
Showing
10 changed files
with
186 additions
and
37 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
common/build/generated/ksp/main/kotlin/dev/kord/common/entity/ForumLayoutType.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,94 @@ | ||
// THIS FILE IS AUTO-GENERATED BY KordEnumProcessor.kt, DO NOT EDIT! | ||
@file:Suppress(names = arrayOf("RedundantVisibilityModifier", "IncorrectFormatting", | ||
"ReplaceArrayOfWithLiteral", "SpellCheckingInspection", "GrazieInspection")) | ||
|
||
package dev.kord.common.entity | ||
|
||
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 [ForumLayoutType]s in the | ||
* [Discord Developer Documentation](https://discord.com/developers/docs/resources/channel#forum-layout-types). | ||
*/ | ||
@Serializable(with = ForumLayoutType.Serializer::class) | ||
public sealed class ForumLayoutType( | ||
/** | ||
* The raw value used by Discord. | ||
*/ | ||
public val `value`: Int, | ||
) { | ||
public final override fun equals(other: Any?): Boolean = this === other || | ||
(other is ForumLayoutType && this.value == other.value) | ||
|
||
public final override fun hashCode(): Int = value.hashCode() | ||
|
||
public final override fun toString(): String = | ||
"ForumLayoutType.${this::class.simpleName}(value=$value)" | ||
|
||
/** | ||
* An unknown [ForumLayoutType]. | ||
* | ||
* This is used as a fallback for [ForumLayoutType]s that haven't been added to Kord yet. | ||
*/ | ||
public class Unknown( | ||
`value`: Int, | ||
) : ForumLayoutType(value) | ||
|
||
/** | ||
* No default has been set for forum channel. | ||
*/ | ||
public object NotSet : ForumLayoutType(0) | ||
|
||
/** | ||
* Displays posts as a list. | ||
*/ | ||
public object ListView : ForumLayoutType(1) | ||
|
||
/** | ||
* Displays posts as a collection of tiles | ||
*/ | ||
public object GalleryView : ForumLayoutType(2) | ||
|
||
internal object Serializer : KSerializer<ForumLayoutType> { | ||
public override val descriptor: SerialDescriptor = | ||
PrimitiveSerialDescriptor("dev.kord.common.entity.ForumLayoutType", | ||
PrimitiveKind.INT) | ||
|
||
public override fun serialize(encoder: Encoder, `value`: ForumLayoutType) = | ||
encoder.encodeInt(value.value) | ||
|
||
public override fun deserialize(decoder: Decoder) = when (val value = decoder.decodeInt()) { | ||
0 -> NotSet | ||
1 -> ListView | ||
2 -> GalleryView | ||
else -> Unknown(value) | ||
} | ||
} | ||
|
||
public companion object { | ||
/** | ||
* A [List] of all known [ForumLayoutType]s. | ||
*/ | ||
public val entries: List<ForumLayoutType> by lazy(mode = PUBLICATION) { | ||
listOf( | ||
NotSet, | ||
ListView, | ||
GalleryView, | ||
) | ||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.