All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.json.request.GuildRequests.kt Maven / Gradle / Ivy

package dev.kord.rest.json.request

import dev.kord.common.Color
import dev.kord.common.annotation.KordExperimental
import dev.kord.common.entity.*
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalBoolean
import dev.kord.common.entity.optional.OptionalInt
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.serialization.DurationInSeconds
import kotlinx.datetime.Instant
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.listSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

@Serializable
public data class GuildCreateRequest(
    val name: String,
    val region: Optional = Optional.Missing(),
    val icon: Optional = Optional.Missing(),
    @SerialName("verification_level")
    val verificationLevel: Optional = Optional.Missing(),
    @SerialName("default_message_notifications")
    val defaultNotificationLevel: Optional = Optional.Missing(),
    val explicitContentFilter: Optional = Optional.Missing(),
    val roles: Optional> = Optional.Missing(),
    val channels: Optional> = Optional.Missing(),
    @SerialName("afk_channel_id")
    val afkChannelId: OptionalSnowflake = OptionalSnowflake.Missing,
    @SerialName("afk_timeout")
    val afkTimeout: Optional = Optional.Missing(),
    @SerialName("system_channel_id")
    val systemChannelId: OptionalSnowflake = OptionalSnowflake.Missing
)

@Serializable
public data class GuildChannelCreateRequest(
    val name: String,
    val type: ChannelType,
    val topic: Optional = Optional.Missing(),
    val bitrate: OptionalInt = OptionalInt.Missing,
    @SerialName("user_limit")
    val userLimit: OptionalInt = OptionalInt.Missing,
    @SerialName("rate_limit_per_user")
    val rateLimitPerUser: Optional = Optional.Missing(),
    val position: OptionalInt = OptionalInt.Missing,
    @SerialName("permission_overwrites")
    val permissionOverwrite: Optional> = Optional.Missing(),
    @SerialName("parent_id")
    val parentId: OptionalSnowflake = OptionalSnowflake.Missing,
    val nsfw: OptionalBoolean = OptionalBoolean.Missing,
    val id: OptionalSnowflake = OptionalSnowflake.Missing,
    @SerialName("default_auto_archive_duration")
    val defaultAutoArchiveDuration: Optional = Optional.Missing(),
    @SerialName("default_reaction_emoji")
    val defaultReactionEmoji: Optional = Optional.Missing(),
    @SerialName("default_thread_rate_limit_per_user")
    val defaultThreadRateLimitPerUser: Optional = Optional.Missing(),
    val flags: Optional = Optional.Missing(),
    @SerialName("available_tags")
    val availableTags: Optional?> = Optional.Missing(),
    @SerialName("default_sort_order")
    val defaultSortOrder: Optional = Optional.Missing(),
    @SerialName("default_forum_layout")
    val defaultForumLayout: Optional = Optional.Missing(),
)

@Serializable
public data class ChannelPositionSwapRequest(
    val id: Snowflake,
    val position: OptionalInt? = OptionalInt.Missing,
    @KordExperimental
    @SerialName("lock_permissions")
    val lockPermissions: OptionalBoolean? = OptionalBoolean.Missing,
    @KordExperimental
    @SerialName("parent_id")
    val parentId: OptionalSnowflake? = OptionalSnowflake.Missing,
)

@Serializable(with = GuildChannelPositionModifyRequest.Serializer::class)
public data class GuildChannelPositionModifyRequest(
    val swaps: List
) {
    internal object Serializer : KSerializer {
        private val delegate = ListSerializer(ChannelPositionSwapRequest.serializer())

        @OptIn(ExperimentalSerializationApi::class)
        override val descriptor: SerialDescriptor
            get() = listSerialDescriptor(ChannelPositionSwapRequest.serializer().descriptor)

        override fun serialize(encoder: Encoder, value: GuildChannelPositionModifyRequest) {
            delegate.serialize(encoder, value.swaps)
        }

        override fun deserialize(decoder: Decoder): GuildChannelPositionModifyRequest {
            return GuildChannelPositionModifyRequest(decoder.decodeSerializableValue(delegate))
        }

    }
}

@Serializable
public data class GuildMemberAddRequest(
    @SerialName("access_token")
    val token: String,
    val nick: Optional = Optional.Missing(),
    val roles: Optional> = Optional.Missing(),
    val mute: OptionalBoolean = OptionalBoolean.Missing,
    val deaf: OptionalBoolean = OptionalBoolean.Missing,
    @SerialName("communication_disabled_until")
    val communicationDisabledUntil: Optional = Optional.Missing()
)

@Serializable
public data class GuildMemberModifyRequest(
    val nick: Optional = Optional.Missing(),
    val roles: Optional?> = Optional.Missing(),
    val mute: OptionalBoolean? = OptionalBoolean.Missing,
    val deaf: OptionalBoolean? = OptionalBoolean.Missing,
    @SerialName("channel_id")
    val channelId: OptionalSnowflake? = OptionalSnowflake.Missing,
    @SerialName("communication_disabled_until")
    val communicationDisabledUntil: Optional = Optional.Missing(),
    val flags: Optional = Optional.Missing(),
)


@Serializable
public data class GuildBanCreateRequest(
    @SerialName("delete_message_seconds")
    val deleteMessageSeconds: Optional = Optional.Missing(),
)

@Serializable
public data class GuildRoleCreateRequest(
    val name: Optional = Optional.Missing(),
    val permissions: Optional = Optional.Missing(),
    val color: Optional = Optional.Missing(),
    val hoist: OptionalBoolean = OptionalBoolean.Missing,
    val icon: Optional = Optional.Missing(),
    @SerialName("unicode_emoji")
    val unicodeEmoji: Optional = Optional.Missing(),
    val mentionable: OptionalBoolean = OptionalBoolean.Missing,
    /** Only use this when creating a guild with roles. */
    val id: OptionalSnowflake = OptionalSnowflake.Missing,
)


@Serializable(with = GuildRolePositionModifyRequest.Serializer::class)
public data class GuildRolePositionModifyRequest(val swaps: List>) {

    internal object Serializer : KSerializer {

        @OptIn(ExperimentalSerializationApi::class)
        override val descriptor: SerialDescriptor
            get() = listSerialDescriptor(RolePosition.serializer().descriptor)

        override fun serialize(encoder: Encoder, value: GuildRolePositionModifyRequest) {
            val positions = value.swaps.map { RolePosition(it.first, it.second) }
            ListSerializer(RolePosition.serializer()).serialize(encoder, positions)
        }

        override fun deserialize(decoder: Decoder): GuildRolePositionModifyRequest {
            val values = decoder.decodeSerializableValue(ListSerializer(RolePosition.serializer()))
            return GuildRolePositionModifyRequest(values.map { it.id to it.position })
        }

    }

    @Serializable
    private data class RolePosition(val id: Snowflake, val position: Int)
}

@Serializable
public data class GuildRoleModifyRequest(
    val name: Optional = Optional.Missing(),
    val permissions: Optional = Optional.Missing(),
    val color: Optional = Optional.Missing(),
    val hoist: OptionalBoolean? = OptionalBoolean.Missing,
    val icon: Optional = Optional.Missing(),
    @SerialName("unicode_emoji")
    val unicodeEmoji: Optional = Optional.Missing(),
    val mentionable: OptionalBoolean? = OptionalBoolean.Missing,
)

@Serializable
public data class GuildMFALevelModifyRequest(val level: MFALevel)

@Serializable
public data class GuildIntegrationCreateRequest(val type: Int, val id: String)

@Serializable
public data class GuildIntegrationModifyRequest(
    @SerialName("expire_behavior")
    val expireBehavior: Optional = Optional.Missing(),
    @SerialName("expire_grace_period")
    val expirePeriod: OptionalInt? = OptionalInt.Missing,
    @SerialName("enable_emoticons")
    val emoticons: OptionalBoolean = OptionalBoolean.Missing,
)

@Serializable
public data class GuildWidgetModifyRequest(
    val enabled: OptionalBoolean = OptionalBoolean.Missing,
    @SerialName("channel_id")
    val channelId: OptionalSnowflake? = OptionalSnowflake.Missing,
)

@Serializable
public data class CurrentUserNicknameModifyRequest(
    val nick: Optional = Optional.Missing()
)

@Serializable
public data class GuildModifyRequest(
    val name: Optional = Optional.Missing(),
    val region: Optional = Optional.Missing(),
    @SerialName("verification_level")
    val verificationLevel: Optional = Optional.Missing(),
    @SerialName("default_message_notifications")
    val defaultMessageNotificationLevel: Optional = Optional.Missing(),
    @SerialName("explicit_content_filter")
    val contentFilter: Optional = Optional.Missing(),
    @SerialName("afk_channel_id")
    val afkChannelId: OptionalSnowflake? = OptionalSnowflake.Missing,
    @SerialName("afk_timeout")
    val afkTimeout: Optional = Optional.Missing(),
    val icon: Optional = Optional.Missing(),
    @SerialName("owner_id")
    val ownerId: OptionalSnowflake = OptionalSnowflake.Missing,
    val splash: Optional = Optional.Missing(),
    val banner: Optional = Optional.Missing(),
    @SerialName("system_channel_id")
    val systemChannelId: OptionalSnowflake? = OptionalSnowflake.Missing,
    @SerialName("rules_channel_id")
    val rulesChannelId: OptionalSnowflake? = OptionalSnowflake.Missing,
    @SerialName("public_updates_channel_id")
    val publicUpdatesChannelId: OptionalSnowflake? = OptionalSnowflake.Missing,
    @SerialName("preferred_locale")
    val preferredLocale: Optional = Optional.Missing(),
    val features: Optional> = Optional.Missing(),
    @SerialName("safety_alerts_channel_id")
    val safetyAlertsChannelId: OptionalSnowflake? = OptionalSnowflake.Missing,
)

@Serializable
public data class GuildWelcomeScreenModifyRequest(
    val enabled: OptionalBoolean = OptionalBoolean.Missing,
    val welcomeScreenChannels: Optional> = Optional.Missing(),
    val description: Optional = Optional.Missing()
)


@Serializable
public data class GuildScheduledEventUsersResponse(
    @SerialName("guild_scheduled_event_id")
    val guildScheduledEventId: Snowflake,
    val user: DiscordUser,
    val member: Optional = Optional.Missing(),
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy