-
Notifications
You must be signed in to change notification settings - Fork 81
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 member-profile-rule
# Conflicts: # core/src/commonMain/kotlin/Unsafe.kt
- Loading branch information
Showing
71 changed files
with
4,329 additions
and
75 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
88 changes: 88 additions & 0 deletions
88
...d/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/EntitlementOwnerType.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,88 @@ | ||
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT! | ||
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral", | ||
"SpellCheckingInspection", "GrazieInspection")) | ||
|
||
package dev.kord.common.entity | ||
|
||
import kotlin.LazyThreadSafetyMode.PUBLICATION | ||
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 [EntitlementOwnerType]s in the | ||
* [Discord Developer Documentation](https://discord.com/developers/docs/resources/entitlement#create-test-entitlement-json-params). | ||
*/ | ||
@Serializable(with = EntitlementOwnerType.Serializer::class) | ||
public sealed class EntitlementOwnerType( | ||
/** | ||
* The raw value used by Discord. | ||
*/ | ||
public val `value`: Int, | ||
) { | ||
final override fun equals(other: Any?): Boolean = this === other || | ||
(other is EntitlementOwnerType && this.value == other.value) | ||
|
||
final override fun hashCode(): Int = value.hashCode() | ||
|
||
final override fun toString(): String = | ||
if (this is Unknown) "EntitlementOwnerType.Unknown(value=$value)" | ||
else "EntitlementOwnerType.${this::class.simpleName}" | ||
|
||
/** | ||
* An unknown [EntitlementOwnerType]. | ||
* | ||
* This is used as a fallback for [EntitlementOwnerType]s that haven't been added to Kord yet. | ||
*/ | ||
public class Unknown internal constructor( | ||
`value`: Int, | ||
) : EntitlementOwnerType(value) | ||
|
||
/** | ||
* Entitlement is owned by a guild. | ||
*/ | ||
public object Guild : EntitlementOwnerType(1) | ||
|
||
/** | ||
* Entitlement is owned by a user. | ||
*/ | ||
public object User : EntitlementOwnerType(2) | ||
|
||
internal object Serializer : KSerializer<EntitlementOwnerType> { | ||
override val descriptor: SerialDescriptor = | ||
PrimitiveSerialDescriptor("dev.kord.common.entity.EntitlementOwnerType", | ||
PrimitiveKind.INT) | ||
|
||
override fun serialize(encoder: Encoder, `value`: EntitlementOwnerType) { | ||
encoder.encodeInt(value.value) | ||
} | ||
|
||
override fun deserialize(decoder: Decoder): EntitlementOwnerType = from(decoder.decodeInt()) | ||
} | ||
|
||
public companion object { | ||
/** | ||
* A [List] of all known [EntitlementOwnerType]s. | ||
*/ | ||
public val entries: List<EntitlementOwnerType> by lazy(mode = PUBLICATION) { | ||
listOf( | ||
Guild, | ||
User, | ||
) | ||
} | ||
|
||
/** | ||
* Returns an instance of [EntitlementOwnerType] with [EntitlementOwnerType.value] equal to | ||
* the specified [value]. | ||
*/ | ||
public fun from(`value`: Int): EntitlementOwnerType = when (value) { | ||
1 -> Guild | ||
2 -> User | ||
else -> Unknown(value) | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
.../build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/EntitlementType.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,130 @@ | ||
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT! | ||
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral", | ||
"SpellCheckingInspection", "GrazieInspection")) | ||
|
||
package dev.kord.common.entity | ||
|
||
import kotlin.LazyThreadSafetyMode.PUBLICATION | ||
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 [EntitlementType]s in the | ||
* [Discord Developer Documentation](https://discord.com/developers/docs/resources/entitlement#entitlement-object-entitlement-types). | ||
*/ | ||
@Serializable(with = EntitlementType.Serializer::class) | ||
public sealed class EntitlementType( | ||
/** | ||
* The raw value used by Discord. | ||
*/ | ||
public val `value`: Int, | ||
) { | ||
final override fun equals(other: Any?): Boolean = this === other || | ||
(other is EntitlementType && this.value == other.value) | ||
|
||
final override fun hashCode(): Int = value.hashCode() | ||
|
||
final override fun toString(): String = | ||
if (this is Unknown) "EntitlementType.Unknown(value=$value)" | ||
else "EntitlementType.${this::class.simpleName}" | ||
|
||
/** | ||
* An unknown [EntitlementType]. | ||
* | ||
* This is used as a fallback for [EntitlementType]s that haven't been added to Kord yet. | ||
*/ | ||
public class Unknown internal constructor( | ||
`value`: Int, | ||
) : EntitlementType(value) | ||
|
||
/** | ||
* Entitlement that was purchased by a user. | ||
*/ | ||
public object Purchase : EntitlementType(1) | ||
|
||
/** | ||
* Entitlement for a Discord Nitro subscription. | ||
*/ | ||
public object PremiumSubscription : EntitlementType(2) | ||
|
||
/** | ||
* Entitlement that was gifted to a user by the developer. | ||
*/ | ||
public object DeveloperGift : EntitlementType(3) | ||
|
||
/** | ||
* Entitlement that was purchased by a dev in application test mode. | ||
*/ | ||
public object TestModePurchase : EntitlementType(4) | ||
|
||
/** | ||
* Entitlement that was granted when the [SKU][DiscordSku] was free. | ||
*/ | ||
public object FreePurchase : EntitlementType(5) | ||
|
||
/** | ||
* Entitlement that was gifted to a user by another user. | ||
*/ | ||
public object UserGift : EntitlementType(6) | ||
|
||
/** | ||
* Entitlement that was claimed by a user for free as a Nitro subscriber. | ||
*/ | ||
public object PremiumPurchase : EntitlementType(7) | ||
|
||
/** | ||
* Entitlement that was purchased as an app subscription. | ||
*/ | ||
public object ApplicationSubscription : EntitlementType(8) | ||
|
||
internal object Serializer : KSerializer<EntitlementType> { | ||
override val descriptor: SerialDescriptor = | ||
PrimitiveSerialDescriptor("dev.kord.common.entity.EntitlementType", | ||
PrimitiveKind.INT) | ||
|
||
override fun serialize(encoder: Encoder, `value`: EntitlementType) { | ||
encoder.encodeInt(value.value) | ||
} | ||
|
||
override fun deserialize(decoder: Decoder): EntitlementType = from(decoder.decodeInt()) | ||
} | ||
|
||
public companion object { | ||
/** | ||
* A [List] of all known [EntitlementType]s. | ||
*/ | ||
public val entries: List<EntitlementType> by lazy(mode = PUBLICATION) { | ||
listOf( | ||
Purchase, | ||
PremiumSubscription, | ||
DeveloperGift, | ||
TestModePurchase, | ||
FreePurchase, | ||
UserGift, | ||
PremiumPurchase, | ||
ApplicationSubscription, | ||
) | ||
} | ||
|
||
/** | ||
* Returns an instance of [EntitlementType] with [EntitlementType.value] equal to the | ||
* specified [value]. | ||
*/ | ||
public fun from(`value`: Int): EntitlementType = when (value) { | ||
1 -> Purchase | ||
2 -> PremiumSubscription | ||
3 -> DeveloperGift | ||
4 -> TestModePurchase | ||
5 -> FreePurchase | ||
6 -> UserGift | ||
7 -> PremiumPurchase | ||
8 -> ApplicationSubscription | ||
else -> Unknown(value) | ||
} | ||
} | ||
} |
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.