commonMain.cache.data.ApplicationData.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kord-core-jvm Show documentation
Show all versions of kord-core-jvm Show documentation
Idiomatic Kotlin Wrapper for The Discord API
package dev.kord.core.cache.data
import dev.kord.common.entity.*
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.entity.optional.mapSnowflake
import kotlinx.serialization.Serializable
public sealed interface BaseApplicationData {
public val id: Snowflake
public val name: String
public val icon: String?
public val description: String
public val rpcOrigins: Optional>
public val termsOfServiceUrl: Optional
public val privacyPolicyUrl: Optional
public val ownerId: OptionalSnowflake
public val verifyKey: String
public val guildId: OptionalSnowflake
public val primarySkuId: OptionalSnowflake
public val slug: Optional
public val coverImage: Optional
public val flags: Optional
public val tags: Optional>
public val installParams: Optional
public val customInstallUrl: Optional
public val roleConnectionsVerificationUrl: Optional
}
@Serializable
public data class ApplicationData(
override val id: Snowflake,
override val name: String,
override val icon: String?,
override val description: String,
override val rpcOrigins: Optional> = Optional.Missing(),
val botPublic: Boolean,
val botRequireCodeGrant: Boolean,
override val termsOfServiceUrl: Optional = Optional.Missing(),
override val privacyPolicyUrl: Optional = Optional.Missing(),
override val ownerId: OptionalSnowflake = OptionalSnowflake.Missing,
override val verifyKey: String,
val team: TeamData?,
override val guildId: OptionalSnowflake = OptionalSnowflake.Missing,
override val primarySkuId: OptionalSnowflake = OptionalSnowflake.Missing,
override val slug: Optional = Optional.Missing(),
override val coverImage: Optional = Optional.Missing(),
override val flags: Optional = Optional.Missing(),
override val tags: Optional> = Optional.Missing(),
override val installParams: Optional = Optional.Missing(),
override val customInstallUrl: Optional = Optional.Missing(),
override val roleConnectionsVerificationUrl: Optional = Optional.Missing(),
) : BaseApplicationData {
public companion object {
public fun from(entity: DiscordApplication): ApplicationData = with(entity) {
ApplicationData(
id,
name,
icon,
description,
rpcOrigins,
botPublic,
botRequireCodeGrant,
termsOfServiceUrl,
privacyPolicyUrl,
owner.mapSnowflake { it.id },
verifyKey,
team?.let { TeamData.from(it) },
guildId,
primarySkuId,
slug,
coverImage,
flags,
tags,
installParams,
customInstallUrl,
roleConnectionsVerificationUrl,
)
}
}
}
@Serializable
public data class PartialApplicationData(
override val id: Snowflake,
override val name: String,
override val icon: String?,
override val description: String,
override val rpcOrigins: Optional> = Optional.Missing(),
override val termsOfServiceUrl: Optional = Optional.Missing(),
override val privacyPolicyUrl: Optional = Optional.Missing(),
override val ownerId: OptionalSnowflake = OptionalSnowflake.Missing,
override val verifyKey: String,
override val guildId: OptionalSnowflake = OptionalSnowflake.Missing,
override val primarySkuId: OptionalSnowflake = OptionalSnowflake.Missing,
override val slug: Optional = Optional.Missing(),
override val coverImage: Optional = Optional.Missing(),
override val flags: Optional = Optional.Missing(),
override val tags: Optional> = Optional.Missing(),
override val installParams: Optional = Optional.Missing(),
override val customInstallUrl: Optional = Optional.Missing(),
override val roleConnectionsVerificationUrl: Optional = Optional.Missing(),
) : BaseApplicationData {
public companion object {
public fun from(entity: DiscordPartialApplication): PartialApplicationData = with(entity) {
PartialApplicationData(
id,
name,
icon,
description,
rpcOrigins,
termsOfServiceUrl,
privacyPolicyUrl,
owner.mapSnowflake { it.id },
verifyKey,
guildId,
primarySkuId,
slug,
coverImage,
flags,
tags,
installParams,
customInstallUrl,
roleConnectionsVerificationUrl,
)
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy