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

All flags and Color migrated to value classes #947

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
594 changes: 325 additions & 269 deletions common/api/common.api

Large diffs are not rendered by default.

640 changes: 315 additions & 325 deletions common/api/common.klib.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

import kotlin.LazyThreadSafetyMode.PUBLICATION
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
import kotlin.jvm.JvmInline
import kotlin.jvm.JvmName
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -191,8 +192,9 @@ public sealed class ActivityFlag(
* @see ActivityFlag
* @see ActivityFlags.Builder
*/
@JvmInline
@Serializable(with = ActivityFlags.Serializer::class)
public class ActivityFlags internal constructor(
public value class ActivityFlags internal constructor(
/**
* The raw value used by Discord.
*/
Expand Down Expand Up @@ -260,11 +262,6 @@ public class ActivityFlags internal constructor(
return Builder(value).apply(builder).build()
}

override fun equals(other: Any?): Boolean = this === other ||
(other is ActivityFlags && this.value == other.value)

override fun hashCode(): Int = value.hashCode()

override fun toString(): String = "ActivityFlags(values=$values)"

public class Builder(
Expand Down Expand Up @@ -336,14 +333,6 @@ public fun ActivityFlags(vararg flags: ActivityFlag): ActivityFlags = ActivityFl
flags.forEach { +it }
}

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in any element of
* [flags].
*/
public fun ActivityFlags(vararg flags: ActivityFlags): ActivityFlags = ActivityFlags {
flags.forEach { +it }
}

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in any element of
* [flags].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

import kotlin.LazyThreadSafetyMode.PUBLICATION
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
import kotlin.jvm.JvmInline
import kotlin.jvm.JvmName
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -237,8 +238,9 @@ public sealed class ApplicationFlag(
* @see ApplicationFlag
* @see ApplicationFlags.Builder
*/
@JvmInline
@Serializable(with = ApplicationFlags.Serializer::class)
public class ApplicationFlags internal constructor(
public value class ApplicationFlags internal constructor(
/**
* The raw code used by Discord.
*/
Expand Down Expand Up @@ -306,11 +308,6 @@ public class ApplicationFlags internal constructor(
return Builder(code).apply(builder).build()
}

override fun equals(other: Any?): Boolean = this === other ||
(other is ApplicationFlags && this.code == other.code)

override fun hashCode(): Int = code.hashCode()

override fun toString(): String = "ApplicationFlags(values=$values)"

public class Builder(
Expand Down Expand Up @@ -384,14 +381,6 @@ public fun ApplicationFlags(vararg flags: ApplicationFlag): ApplicationFlags = A
flags.forEach { +it }
}

/**
* Returns an instance of [ApplicationFlags] that has all bits set that are set in any element of
* [flags].
*/
public fun ApplicationFlags(vararg flags: ApplicationFlags): ApplicationFlags = ApplicationFlags {
flags.forEach { +it }
}

/**
* Returns an instance of [ApplicationFlags] that has all bits set that are set in any element of
* [flags].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

import kotlin.LazyThreadSafetyMode.PUBLICATION
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
import kotlin.jvm.JvmInline
import kotlin.jvm.JvmName
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -162,8 +163,9 @@ public sealed class AttachmentFlag(
* @see AttachmentFlag
* @see AttachmentFlags.Builder
*/
@JvmInline
@Serializable(with = AttachmentFlags.Serializer::class)
public class AttachmentFlags internal constructor(
public value class AttachmentFlags internal constructor(
/**
* The raw value used by Discord.
*/
Expand Down Expand Up @@ -231,11 +233,6 @@ public class AttachmentFlags internal constructor(
return Builder(value).apply(builder).build()
}

override fun equals(other: Any?): Boolean = this === other ||
(other is AttachmentFlags && this.value == other.value)

override fun hashCode(): Int = value.hashCode()

override fun toString(): String = "AttachmentFlags(values=$values)"

public class Builder(
Expand Down Expand Up @@ -309,14 +306,6 @@ public fun AttachmentFlags(vararg flags: AttachmentFlag): AttachmentFlags = Atta
flags.forEach { +it }
}

/**
* Returns an instance of [AttachmentFlags] that has all bits set that are set in any element of
* [flags].
*/
public fun AttachmentFlags(vararg flags: AttachmentFlags): AttachmentFlags = AttachmentFlags {
flags.forEach { +it }
}

/**
* Returns an instance of [AttachmentFlags] that has all bits set that are set in any element of
* [flags].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

import kotlin.LazyThreadSafetyMode.PUBLICATION
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
import kotlin.jvm.JvmInline
import kotlin.jvm.JvmName
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -176,8 +177,9 @@ public sealed class ChannelFlag(
* @see ChannelFlag
* @see ChannelFlags.Builder
*/
@JvmInline
@Serializable(with = ChannelFlags.Serializer::class)
public class ChannelFlags internal constructor(
public value class ChannelFlags internal constructor(
/**
* The raw code used by Discord.
*/
Expand Down Expand Up @@ -243,11 +245,6 @@ public class ChannelFlags internal constructor(
return Builder(code).apply(builder).build()
}

override fun equals(other: Any?): Boolean = this === other ||
(other is ChannelFlags && this.code == other.code)

override fun hashCode(): Int = code.hashCode()

override fun toString(): String = "ChannelFlags(values=$values)"

public class Builder(
Expand Down Expand Up @@ -319,14 +316,6 @@ public fun ChannelFlags(vararg flags: ChannelFlag): ChannelFlags = ChannelFlags
flags.forEach { +it }
}

/**
* Returns an instance of [ChannelFlags] that has all bits set that are set in any element of
* [flags].
*/
public fun ChannelFlags(vararg flags: ChannelFlags): ChannelFlags = ChannelFlags {
flags.forEach { +it }
}

/**
* Returns an instance of [ChannelFlags] that has all bits set that are set in any element of
* [flags].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))
"SpellCheckingInspection", "GrazieInspection", "MemberVisibilityCanBePrivate"))

package dev.kord.common.entity

Expand Down
Loading