Skip to content

Commit

Permalink
chore: don't implement Strategizable for Entitlement
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Sep 8, 2024
1 parent 3e4498d commit 1b68967
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
8 changes: 2 additions & 6 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -6090,9 +6090,8 @@ public abstract interface class dev/kord/core/entity/Emoji {
public abstract fun getName ()Ljava/lang/String;
}

public final class dev/kord/core/entity/Entitlement : dev/kord/core/entity/KordEntity, dev/kord/core/entity/Strategizable {
public fun <init> (Ldev/kord/core/cache/data/EntitlementData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;)V
public synthetic fun <init> (Ldev/kord/core/cache/data/EntitlementData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final class dev/kord/core/entity/Entitlement : dev/kord/core/entity/KordEntity {
public fun <init> (Ldev/kord/core/cache/data/EntitlementData;Ldev/kord/core/Kord;)V
public fun compareTo (Ldev/kord/core/entity/Entity;)I
public synthetic fun compareTo (Ljava/lang/Object;)I
public final fun consume (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand All @@ -6107,7 +6106,6 @@ public final class dev/kord/core/entity/Entitlement : dev/kord/core/entity/KordE
public fun getKord ()Ldev/kord/core/Kord;
public final fun getSkuId ()Ldev/kord/common/entity/Snowflake;
public final fun getStartsAt ()Lkotlinx/datetime/Instant;
public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier;
public final fun getType ()Ldev/kord/common/entity/EntitlementType;
public final fun getUser ()Ldev/kord/core/behavior/UserBehavior;
public final fun getUserId ()Ldev/kord/common/entity/Snowflake;
Expand All @@ -6116,8 +6114,6 @@ public final class dev/kord/core/entity/Entitlement : dev/kord/core/entity/KordE
public final fun isDeleted ()Z
public final fun isTest ()Z
public fun toString ()Ljava/lang/String;
public fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/Entitlement;
public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/Strategizable;
}

public abstract interface class dev/kord/core/entity/Entity : java/lang/Comparable {
Expand Down
7 changes: 2 additions & 5 deletions core/api/core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -7377,8 +7377,8 @@ final class dev.kord.core.entity/Embed : dev.kord.core/KordObject { // dev.kord.
}
}

final class dev.kord.core.entity/Entitlement : dev.kord.core.entity/KordEntity, dev.kord.core.entity/Strategizable { // dev.kord.core.entity/Entitlement|null[0]
constructor <init>(dev.kord.core.cache.data/EntitlementData, dev.kord.core/Kord, dev.kord.core.supplier/EntitySupplier = ...) // dev.kord.core.entity/Entitlement.<init>|<init>(dev.kord.core.cache.data.EntitlementData;dev.kord.core.Kord;dev.kord.core.supplier.EntitySupplier){}[0]
final class dev.kord.core.entity/Entitlement : dev.kord.core.entity/KordEntity { // dev.kord.core.entity/Entitlement|null[0]
constructor <init>(dev.kord.core.cache.data/EntitlementData, dev.kord.core/Kord) // dev.kord.core.entity/Entitlement.<init>|<init>(dev.kord.core.cache.data.EntitlementData;dev.kord.core.Kord){}[0]

final val applicationId // dev.kord.core.entity/Entitlement.applicationId|{}applicationId[0]
final fun <get-applicationId>(): dev.kord.common.entity/Snowflake // dev.kord.core.entity/Entitlement.applicationId.<get-applicationId>|<get-applicationId>(){}[0]
Expand All @@ -7404,8 +7404,6 @@ final class dev.kord.core.entity/Entitlement : dev.kord.core.entity/KordEntity,
final fun <get-skuId>(): dev.kord.common.entity/Snowflake // dev.kord.core.entity/Entitlement.skuId.<get-skuId>|<get-skuId>(){}[0]
final val startsAt // dev.kord.core.entity/Entitlement.startsAt|{}startsAt[0]
final fun <get-startsAt>(): kotlinx.datetime/Instant? // dev.kord.core.entity/Entitlement.startsAt.<get-startsAt>|<get-startsAt>(){}[0]
final val supplier // dev.kord.core.entity/Entitlement.supplier|{}supplier[0]
final fun <get-supplier>(): dev.kord.core.supplier/EntitySupplier // dev.kord.core.entity/Entitlement.supplier.<get-supplier>|<get-supplier>(){}[0]
final val type // dev.kord.core.entity/Entitlement.type|{}type[0]
final fun <get-type>(): dev.kord.common.entity/EntitlementType // dev.kord.core.entity/Entitlement.type.<get-type>|<get-type>(){}[0]
final val user // dev.kord.core.entity/Entitlement.user|{}user[0]
Expand All @@ -7416,7 +7414,6 @@ final class dev.kord.core.entity/Entitlement : dev.kord.core.entity/KordEntity,
final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.core.entity/Entitlement.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // dev.kord.core.entity/Entitlement.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // dev.kord.core.entity/Entitlement.toString|toString(){}[0]
final fun withStrategy(dev.kord.core.supplier/EntitySupplyStrategy<*>): dev.kord.core.entity/Entitlement // dev.kord.core.entity/Entitlement.withStrategy|withStrategy(dev.kord.core.supplier.EntitySupplyStrategy<*>){}[0]
final suspend fun consume() // dev.kord.core.entity/Entitlement.consume|consume(){}[0]
final suspend fun delete() // dev.kord.core.entity/Entitlement.delete|delete(){}[0]
}
Expand Down
12 changes: 2 additions & 10 deletions core/src/commonMain/kotlin/entity/Entitlement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.behavior.UserBehavior
import dev.kord.core.cache.data.EntitlementData
import dev.kord.core.hash
import dev.kord.core.supplier.EntitySupplier
import dev.kord.core.supplier.EntitySupplyStrategy
import dev.kord.rest.request.RestRequestException
import kotlinx.datetime.Instant

Expand All @@ -21,8 +19,7 @@ import kotlinx.datetime.Instant
public class Entitlement(
public val data: EntitlementData,
override val kord: Kord,
override val supplier: EntitySupplier = kord.defaultSupplier,
) : KordEntity, Strategizable {
) : KordEntity {
override val id: Snowflake
get() = data.id

Expand Down Expand Up @@ -122,17 +119,12 @@ public class Entitlement(
kord.rest.entitlement.consumeEntitlement(applicationId, id)
}

override fun withStrategy(strategy: EntitySupplyStrategy<*>): Entitlement =
Entitlement(data, kord, strategy.supply(kord))

override fun hashCode(): Int = hash(id, applicationId)

override fun equals(other: Any?): Boolean = when (other) {
is Entitlement -> other.id == id && other.applicationId == applicationId
else -> false
}

override fun toString(): String {
return "Entitlement(data=$data, kord=$kord, supplier=$supplier)"
}
override fun toString(): String = "Entitlement(data=$data, kord=$kord)"
}

0 comments on commit 1b68967

Please sign in to comment.