Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional.Missing and Optional.Null migrated to kotlin objects #946

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions common/api/common.api
Original file line number Diff line number Diff line change
Expand Up @@ -8774,7 +8774,7 @@ public final class dev/kord/common/entity/WebhookType$Unknown : dev/kord/common/

public abstract class dev/kord/common/entity/optional/Optional {
public static final field Companion Ldev/kord/common/entity/optional/Optional$Companion;
public fun getValue ()Ljava/lang/Object;
public abstract fun getValue ()Ljava/lang/Object;
}

public final class dev/kord/common/entity/optional/Optional$Companion {
Expand All @@ -8786,32 +8786,30 @@ public final class dev/kord/common/entity/optional/Optional$Companion {
}

public final class dev/kord/common/entity/optional/Optional$Missing : dev/kord/common/entity/optional/Optional {
public static final field Companion Ldev/kord/common/entity/optional/Optional$Missing$Companion;
public static final field INSTANCE Ldev/kord/common/entity/optional/Optional$Missing;
public fun equals (Ljava/lang/Object;)Z
public fun getValue ()Ljava/lang/Object;
public synthetic fun getValue ()Ljava/lang/Object;
public fun getValue ()Ljava/lang/Void;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/optional/Optional$Missing$Companion {
public final fun invoke ()Ldev/kord/common/entity/optional/Optional$Missing;
public fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/optional/Optional$Null : dev/kord/common/entity/optional/Optional {
public static final field Companion Ldev/kord/common/entity/optional/Optional$Null$Companion;
public static final field INSTANCE Ldev/kord/common/entity/optional/Optional$Null;
public fun equals (Ljava/lang/Object;)Z
public fun getValue ()Ljava/lang/Object;
public synthetic fun getValue ()Ljava/lang/Object;
public fun getValue ()Ljava/lang/Void;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/optional/Optional$Null$Companion {
public final fun invoke ()Ldev/kord/common/entity/optional/Optional$Null;
public fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/optional/Optional$Value : dev/kord/common/entity/optional/Optional {
public fun <init> (Ljava/lang/Object;)V
public final fun component1 ()Ljava/lang/Object;
public final fun copy (Ljava/lang/Object;)Ldev/kord/common/entity/optional/Optional$Value;
public static synthetic fun copy$default (Ldev/kord/common/entity/optional/Optional$Value;Ljava/lang/Object;ILjava/lang/Object;)Ldev/kord/common/entity/optional/Optional$Value;
public fun equals (Ljava/lang/Object;)Z
public fun getValue ()Ljava/lang/Object;
public fun hashCode ()I
Expand All @@ -8833,6 +8831,8 @@ public final class dev/kord/common/entity/optional/OptionalBoolean$Companion {

public final class dev/kord/common/entity/optional/OptionalBoolean$Missing : dev/kord/common/entity/optional/OptionalBoolean {
public static final field INSTANCE Ldev/kord/common/entity/optional/OptionalBoolean$Missing;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

Expand Down Expand Up @@ -8865,6 +8865,8 @@ public final class dev/kord/common/entity/optional/OptionalInt$Companion {

public final class dev/kord/common/entity/optional/OptionalInt$Missing : dev/kord/common/entity/optional/OptionalInt {
public static final field INSTANCE Ldev/kord/common/entity/optional/OptionalInt$Missing;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

Expand Down Expand Up @@ -8926,6 +8928,8 @@ public final class dev/kord/common/entity/optional/OptionalLong$Companion {

public final class dev/kord/common/entity/optional/OptionalLong$Missing : dev/kord/common/entity/optional/OptionalLong {
public static final field INSTANCE Ldev/kord/common/entity/optional/OptionalLong$Missing;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

Expand Down Expand Up @@ -8958,6 +8962,8 @@ public final class dev/kord/common/entity/optional/OptionalSnowflake$Companion {

public final class dev/kord/common/entity/optional/OptionalSnowflake$Missing : dev/kord/common/entity/optional/OptionalSnowflake {
public static final field INSTANCE Ldev/kord/common/entity/optional/OptionalSnowflake$Missing;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

Expand Down
45 changes: 25 additions & 20 deletions common/api/common.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -5627,46 +5627,43 @@ sealed class <#A: kotlin/Any?> dev.kord.common.entity/AuditLogChangeKey { // dev
open fun toString(): kotlin/String // dev.kord.common.entity/AuditLogChangeKey.toString|toString(){}[0]
}
sealed class <#A: out kotlin/Any?> dev.kord.common.entity.optional/Optional { // dev.kord.common.entity.optional/Optional|null[0]
abstract val value // dev.kord.common.entity.optional/Optional.value|{}value[0]
abstract fun <get-value>(): #A? // dev.kord.common.entity.optional/Optional.value.<get-value>|<get-value>(){}[0]
constructor <init>() // dev.kord.common.entity.optional/Optional.<init>|<init>(){}[0]
final class <#A1: kotlin/Any> Value : dev.kord.common.entity.optional/Optional<#A1> { // dev.kord.common.entity.optional/Optional.Value|null[0]
constructor <init>(#A1) // dev.kord.common.entity.optional/Optional.Value.<init>|<init>(1:0){}[0]
final fun component1(): #A1 // dev.kord.common.entity.optional/Optional.Value.component1|component1(){}[0]
final fun copy(#A1 =...): dev.kord.common.entity.optional/Optional.Value<#A1> // dev.kord.common.entity.optional/Optional.Value.copy|copy(1:0){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/Optional.Value.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/Optional.Value.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/Optional.Value.toString|toString(){}[0]
final val value // dev.kord.common.entity.optional/Optional.Value.value|{}value[0]
final fun <get-value>(): #A1 // dev.kord.common.entity.optional/Optional.Value.value.<get-value>|<get-value>(){}[0]
}
final class <#A1: out kotlin/Any?> Missing : dev.kord.common.entity.optional/Optional<#A1> { // dev.kord.common.entity.optional/Optional.Missing|null[0]
final object Companion : kotlinx.serialization.internal/SerializerFactory { // dev.kord.common.entity.optional/Optional.Companion|null[0]
final fun <#A2: kotlin/Any> invoke(#A2): dev.kord.common.entity.optional/Optional.Value<#A2> // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(0:0){0§<kotlin.Any>}[0]
final fun <#A2: kotlin/Any> invoke(#A2?): dev.kord.common.entity.optional/Optional<#A2?> // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(0:0?){0§<kotlin.Any>}[0]
final fun <#A2: kotlin/Any?, #B2: kotlin.collections/Collection<#A2>> missingOnEmpty(#B2): dev.kord.common.entity.optional/Optional<#B2> // dev.kord.common.entity.optional/Optional.Companion.missingOnEmpty|missingOnEmpty(0:1){0§<kotlin.Any?>;1§<kotlin.collections.Collection<0:0>>}[0]
final fun <#A2: kotlin/Any?> serializer(kotlinx.serialization/KSerializer<#A2>): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/Optional<#A2>> // dev.kord.common.entity.optional/Optional.Companion.serializer|serializer(kotlinx.serialization.KSerializer<0:0>){0§<kotlin.Any?>}[0]
final fun invoke(): dev.kord.common.entity.optional/Optional.Missing // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(){}[0]
final fun serializer(kotlin/Array<out kotlinx.serialization/KSerializer<*>>...): kotlinx.serialization/KSerializer<*> // dev.kord.common.entity.optional/Optional.Companion.serializer|serializer(kotlin.Array<out|kotlinx.serialization.KSerializer<*>>...){}[0]
}
final object Missing : dev.kord.common.entity.optional/Optional<kotlin/Nothing> { // dev.kord.common.entity.optional/Optional.Missing|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/Optional.Missing.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/Optional.Missing.hashCode|hashCode(){}[0]
final fun invoke(): dev.kord.common.entity.optional/Optional.Missing // dev.kord.common.entity.optional/Optional.Missing.invoke|invoke(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/Optional.Missing.toString|toString(){}[0]
final object Companion { // dev.kord.common.entity.optional/Optional.Missing.Companion|null[0]
final fun <#A3: kotlin/Any> invoke(): dev.kord.common.entity.optional/Optional.Missing<#A3> // dev.kord.common.entity.optional/Optional.Missing.Companion.invoke|invoke(){0§<kotlin.Any>}[0]
}
final val value // dev.kord.common.entity.optional/Optional.Missing.value|{}value[0]
final fun <get-value>(): #A1? // dev.kord.common.entity.optional/Optional.Missing.value.<get-value>|<get-value>(){}[0]
final fun <get-value>(): kotlin/Nothing? // dev.kord.common.entity.optional/Optional.Missing.value.<get-value>|<get-value>(){}[0]
}
final class <#A1: out kotlin/Any?> Null : dev.kord.common.entity.optional/Optional<#A1?> { // dev.kord.common.entity.optional/Optional.Null|null[0]
final object Null : dev.kord.common.entity.optional/Optional<kotlin/Nothing> { // dev.kord.common.entity.optional/Optional.Null|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/Optional.Null.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/Optional.Null.hashCode|hashCode(){}[0]
final fun invoke(): dev.kord.common.entity.optional/Optional.Null // dev.kord.common.entity.optional/Optional.Null.invoke|invoke(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/Optional.Null.toString|toString(){}[0]
final object Companion { // dev.kord.common.entity.optional/Optional.Null.Companion|null[0]
final fun <#A3: kotlin/Any> invoke(): dev.kord.common.entity.optional/Optional.Null<#A3> // dev.kord.common.entity.optional/Optional.Null.Companion.invoke|invoke(){0§<kotlin.Any>}[0]
}
final val value // dev.kord.common.entity.optional/Optional.Null.value|{}value[0]
final fun <get-value>(): #A1? // dev.kord.common.entity.optional/Optional.Null.value.<get-value>|<get-value>(){}[0]
}
final object Companion : kotlinx.serialization.internal/SerializerFactory { // dev.kord.common.entity.optional/Optional.Companion|null[0]
final fun <#A2: kotlin/Any> invoke(#A2): dev.kord.common.entity.optional/Optional.Value<#A2> // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(0:0){0§<kotlin.Any>}[0]
final fun <#A2: kotlin/Any> invoke(#A2?): dev.kord.common.entity.optional/Optional<#A2?> // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(0:0?){0§<kotlin.Any>}[0]
final fun <#A2: kotlin/Any> invoke(): dev.kord.common.entity.optional/Optional.Missing<#A2> // dev.kord.common.entity.optional/Optional.Companion.invoke|invoke(){0§<kotlin.Any>}[0]
final fun <#A2: kotlin/Any?, #B2: kotlin.collections/Collection<#A2>> missingOnEmpty(#B2): dev.kord.common.entity.optional/Optional<#B2> // dev.kord.common.entity.optional/Optional.Companion.missingOnEmpty|missingOnEmpty(0:1){0§<kotlin.Any?>;1§<kotlin.collections.Collection<0:0>>}[0]
final fun <#A2: kotlin/Any?> serializer(kotlinx.serialization/KSerializer<#A2>): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/Optional<#A2>> // dev.kord.common.entity.optional/Optional.Companion.serializer|serializer(kotlinx.serialization.KSerializer<0:0>){0§<kotlin.Any?>}[0]
final fun serializer(kotlin/Array<out kotlinx.serialization/KSerializer<*>>...): kotlinx.serialization/KSerializer<*> // dev.kord.common.entity.optional/Optional.Companion.serializer|serializer(kotlin.Array<out|kotlinx.serialization.KSerializer<*>>...){}[0]
final fun <get-value>(): kotlin/Nothing? // dev.kord.common.entity.optional/Optional.Null.value.<get-value>|<get-value>(){}[0]
}
open val value // dev.kord.common.entity.optional/Optional.value|{}value[0]
open fun <get-value>(): #A? // dev.kord.common.entity.optional/Optional.value.<get-value>|<get-value>(){}[0]
}
sealed class <#A: out kotlin/Any?> dev.kord.common.entity/CommandArgument : dev.kord.common.entity/Option { // dev.kord.common.entity/CommandArgument|null[0]
abstract val focused // dev.kord.common.entity/CommandArgument.focused|{}focused[0]
Expand Down Expand Up @@ -5877,6 +5874,8 @@ sealed class dev.kord.common.entity.optional/OptionalBoolean { // dev.kord.commo
final fun serializer(): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/OptionalBoolean> // dev.kord.common.entity.optional/OptionalBoolean.Companion.serializer|serializer(){}[0]
}
final object Missing : dev.kord.common.entity.optional/OptionalBoolean { // dev.kord.common.entity.optional/OptionalBoolean.Missing|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/OptionalBoolean.Missing.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/OptionalBoolean.Missing.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/OptionalBoolean.Missing.toString|toString(){}[0]
}
final val asNullable // dev.kord.common.entity.optional/OptionalBoolean.asNullable|{}asNullable[0]
Expand All @@ -5902,6 +5901,8 @@ sealed class dev.kord.common.entity.optional/OptionalInt { // dev.kord.common.en
final fun serializer(): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/OptionalInt> // dev.kord.common.entity.optional/OptionalInt.Companion.serializer|serializer(){}[0]
}
final object Missing : dev.kord.common.entity.optional/OptionalInt { // dev.kord.common.entity.optional/OptionalInt.Missing|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/OptionalInt.Missing.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/OptionalInt.Missing.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/OptionalInt.Missing.toString|toString(){}[0]
}
final val asNullable // dev.kord.common.entity.optional/OptionalInt.asNullable|{}asNullable[0]
Expand All @@ -5925,6 +5926,8 @@ sealed class dev.kord.common.entity.optional/OptionalLong { // dev.kord.common.e
final fun serializer(): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/OptionalLong> // dev.kord.common.entity.optional/OptionalLong.Companion.serializer|serializer(){}[0]
}
final object Missing : dev.kord.common.entity.optional/OptionalLong { // dev.kord.common.entity.optional/OptionalLong.Missing|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/OptionalLong.Missing.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/OptionalLong.Missing.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/OptionalLong.Missing.toString|toString(){}[0]
}
final val asNullable // dev.kord.common.entity.optional/OptionalLong.asNullable|{}asNullable[0]
Expand All @@ -5949,6 +5952,8 @@ sealed class dev.kord.common.entity.optional/OptionalSnowflake { // dev.kord.com
final fun serializer(): kotlinx.serialization/KSerializer<dev.kord.common.entity.optional/OptionalSnowflake> // dev.kord.common.entity.optional/OptionalSnowflake.Companion.serializer|serializer(){}[0]
}
final object Missing : dev.kord.common.entity.optional/OptionalSnowflake { // dev.kord.common.entity.optional/OptionalSnowflake.Missing|null[0]
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.common.entity.optional/OptionalSnowflake.Missing.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.common.entity.optional/OptionalSnowflake.Missing.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.common.entity.optional/OptionalSnowflake.Missing.toString|toString(){}[0]
}
final val asOptional // dev.kord.common.entity.optional/OptionalSnowflake.asOptional|{}asOptional[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public data class DiscordApplicationRoleConnectionMetadata(
val key: String,
val name: String,
@SerialName("name_localizations")
val nameLocalizations: Optional<Map<Locale, String>> = Optional.Missing(),
val nameLocalizations: Optional<Map<Locale, String>> = Optional.Missing,
val description: String,
@SerialName("description_localizations")
val descriptionLocalizations: Optional<Map<Locale, String>> = Optional.Missing(),
val descriptionLocalizations: Optional<Map<Locale, String>> = Optional.Missing,
)
22 changes: 11 additions & 11 deletions common/src/commonMain/kotlin/entity/AuditLog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ public data class DiscordAuditLog(
public data class DiscordAuditLogEntry(
@SerialName("target_id")
val targetId: Snowflake?,
val changes: Optional<List<AuditLogChange<in @Contextual Any?>>> = Optional.Missing(),
val changes: Optional<List<AuditLogChange<in @Contextual Any?>>> = Optional.Missing,
@SerialName("user_id")
val userId: Snowflake?,
val id: Snowflake,
@SerialName("action_type")
val actionType: AuditLogEvent,
val options: Optional<AuditLogEntryOptionalInfo> = Optional.Missing(),
val reason: Optional<String> = Optional.Missing(),
val options: Optional<AuditLogEntryOptionalInfo> = Optional.Missing,
val reason: Optional<String> = Optional.Missing,
) {

@Suppress("UNCHECKED_CAST")
Expand All @@ -127,21 +127,21 @@ public data class AuditLogEntryOptionalInfo(
@SerialName("application_id")
val applicationId: OptionalSnowflake = OptionalSnowflake.Missing,
@SerialName("auto_moderation_rule_name")
val autoModerationRuleName: Optional<String> = Optional.Missing(),
val autoModerationRuleName: Optional<String> = Optional.Missing,
@SerialName("auto_moderation_rule_trigger_type")
val autoModerationRuleTriggerType: Optional<String> = Optional.Missing(),
val autoModerationRuleTriggerType: Optional<String> = Optional.Missing,
/*
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
*/
@SerialName("delete_member_days")
val deleteMemberDays: Optional<String> = Optional.Missing(),
val deleteMemberDays: Optional<String> = Optional.Missing,
/*
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
*/
@SerialName("members_removed")
val membersRemoved: Optional<String> = Optional.Missing(),
val membersRemoved: Optional<String> = Optional.Missing,
/*
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
Expand All @@ -158,7 +158,7 @@ public data class AuditLogEntryOptionalInfo(
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
*/
val count: Optional<String> = Optional.Missing(),
val count: Optional<String> = Optional.Missing,
/*
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
Expand All @@ -168,15 +168,15 @@ public data class AuditLogEntryOptionalInfo(
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
*/
val type: Optional<OverwriteType> = Optional.Missing(),
val type: Optional<OverwriteType> = Optional.Missing,
/*
Do not trust the docs:
2020-11-12 field is described as present but is in fact optional
*/
@SerialName("role_name")
val roleName: Optional<String> = Optional.Missing(),
val roleName: Optional<String> = Optional.Missing,
@SerialName("integration_type")
val integrationType: Optional<String> = Optional.Missing(),
val integrationType: Optional<String> = Optional.Missing,
)

@Serializable(with = AuditLogChange.Serializer::class)
Expand Down
Loading