Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
commonMain.route.Route.kt Maven / Gradle / Ivy
package dev.kord.rest.route
import dev.kord.common.KordConfiguration
import dev.kord.common.annotation.KordExperimental
import dev.kord.common.entity.*
import dev.kord.rest.json.request.GuildScheduledEventUsersResponse
import dev.kord.rest.json.response.*
import io.ktor.http.*
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.StructureKind
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.json.Json
public sealed interface ResponseMapper {
public fun deserialize(json: Json, body: String): T
}
internal class ValueJsonMapper(val strategy: DeserializationStrategy) : ResponseMapper {
override fun deserialize(json: Json, body: String): T = json.decodeFromString(strategy, body)
override fun toString(): String = "ValueJsonMapper(strategy=$strategy)"
}
internal class NullAwareMapper(val strategy: DeserializationStrategy) : ResponseMapper {
override fun deserialize(json: Json, body: String): T? {
if (body.isBlank()) return null
return json.decodeFromString(strategy, body)
}
override fun toString(): String = "NullAwareMapper(strategy=$strategy)"
}
internal val DeserializationStrategy.optional: ResponseMapper
get() = NullAwareMapper(this)
internal object NoStrategy : DeserializationStrategy {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor
get() = buildSerialDescriptor("NoStrategy", StructureKind.OBJECT) {}
override fun deserialize(decoder: Decoder) {}
}
public sealed class Route(
public val method: HttpMethod,
public val path: String,
public val mapper: ResponseMapper,
public val requiresAuthorizationHeader: Boolean = true,
) {
public companion object {
public val baseUrl: String get() = "https://discord.com/api/v${KordConfiguration.REST_VERSION}"
}
public open class Key(public val identifier: String, public val isMajor: Boolean = false) {
override fun toString(): String = identifier
}
public object GuildId : Key("{guild.id}", true)
public object ChannelId : Key("{channel.id}", true)
public object MessageId : Key("{message.id}")
public object Emoji : Key("{emoji}")
public object UserId : Key("{user.id}")
public object OverwriteId : Key("{overwrite.id}")
public object EmojiId : Key("{emoji.id}")
public object InviteCode : Key("{invite.code}")
public object RoleId : Key("{role.id}")
public object IntegrationId : Key("{integration.id}")
public object WebhookId : Key("{webhook.id}", true)
public object WebhookToken : Key("{webhook.token}")
public object TemplateCode : Key("{template.code}")
public object ApplicationId : Key("{application.id}", true)
public object CommandId : Key("{command.id}", true)
public object InteractionId : Key("{interaction.id}", true)
public object InteractionToken : Key("{interaction.token}", true)
public object ScheduledEventId : Key("{event.id}", true)
public object StickerId : Key("{sticker.id}")
public object AutoModerationRuleId : Key("{auto_moderation_rule.id}")
protected constructor(
method: HttpMethod,
path: String,
strategy: DeserializationStrategy,
requiresAuthorizationHeader: Boolean = true,
) : this(method, path, ValueJsonMapper(strategy), requiresAuthorizationHeader)
override fun toString(): String = "Route(method:${method.value},path:$path,mapper:$mapper)"
/*
* Gateway:
* https://discord.com/developers/docs/topics/gateway
*/
public object GatewayGet :
Route(
HttpMethod.Get,
"/gateway",
GatewayResponse.serializer(),
requiresAuthorizationHeader = false,
)
public object GatewayBotGet :
Route(HttpMethod.Get, "/gateway/bot", BotGatewayResponse.serializer())
/*
* Application Role Connection Metadata:
* https://discord.com/developers/docs/resources/application-role-connection-metadata
*/
public object ApplicationRoleConnectionMetadataRecordsGet :
Route>(
HttpMethod.Get,
"/applications/$ApplicationId/role-connections/metadata",
ListSerializer(DiscordApplicationRoleConnectionMetadata.serializer()),
)
public object ApplicationRoleConnectionMetadataRecordsUpdate :
Route>(
HttpMethod.Put,
"/applications/$ApplicationId/role-connections/metadata",
ListSerializer(DiscordApplicationRoleConnectionMetadata.serializer()),
)
/*
* Audit Log:
* https://discord.com/developers/docs/resources/audit-log
*/
public object AuditLogGet :
Route(HttpMethod.Get, "/guilds/$GuildId/audit-logs", DiscordAuditLog.serializer())
/*
* Auto Moderation:
* https://discord.com/developers/docs/resources/auto-moderation
*/
public object AutoModerationRulesForGuildList :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/auto-moderation/rules",
ListSerializer(DiscordAutoModerationRule.serializer()),
)
public object AutoModerationRuleGet :
Route(
HttpMethod.Get,
"/guilds/$GuildId/auto-moderation/rules/$AutoModerationRuleId",
DiscordAutoModerationRule.serializer(),
)
public object AutoModerationRuleCreate :
Route(
HttpMethod.Post,
"/guilds/$GuildId/auto-moderation/rules",
DiscordAutoModerationRule.serializer(),
)
public object AutoModerationRuleModify :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/auto-moderation/rules/$AutoModerationRuleId",
DiscordAutoModerationRule.serializer(),
)
public object AutoModerationRuleDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/auto-moderation/rules/$AutoModerationRuleId", NoStrategy)
/*
* Channel:
* https://discord.com/developers/docs/resources/channel
*/
public object ChannelGet :
Route(HttpMethod.Get, "/channels/$ChannelId", DiscordChannel.serializer())
public object ChannelPut : // TODO does this route still/even exist?
Route(HttpMethod.Put, "/channels/$ChannelId", DiscordChannel.serializer())
public object ChannelPatch :
Route(HttpMethod.Patch, "/channels/$ChannelId", DiscordChannel.serializer())
public object ChannelDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId", DiscordChannel.serializer())
public object MessagePost :
Route(HttpMethod.Post, "/channels/$ChannelId/messages", DiscordMessage.serializer())
public object MessageGet :
Route(HttpMethod.Get, "/channels/$ChannelId/messages/$MessageId", DiscordMessage.serializer())
public object MessagesGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/messages",
ListSerializer(DiscordMessage.serializer())
)
public object MessageCrosspost :
Route(
HttpMethod.Post,
"/channels/$ChannelId/messages/$MessageId/crosspost",
DiscordMessage.serializer()
)
public object PinsGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/pins",
ListSerializer(DiscordMessage.serializer())
)
public object InvitesGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/invites",
ListSerializer(DiscordInviteWithMetadata.serializer())
)
public object InvitePost :
Route(
HttpMethod.Post,
"/channels/$ChannelId/invites",
DiscordInviteWithMetadata.serializer(),
)
public object ReactionPut :
Route(HttpMethod.Put, "/channels/$ChannelId/messages/$MessageId/reactions/$Emoji/@me", NoStrategy)
public object OwnReactionDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/messages/$MessageId/reactions/$Emoji/@me", NoStrategy)
public object ReactionDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/messages/$MessageId/reactions/$Emoji/$UserId", NoStrategy)
public object DeleteAllReactionsForEmoji :
Route(HttpMethod.Delete, "/channels/$ChannelId/messages/$MessageId/reactions/$Emoji", NoStrategy)
public object MessageDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/messages/$MessageId", NoStrategy)
public object BulkMessageDeletePost :
Route(HttpMethod.Post, "/channels/$ChannelId/messages/bulk-delete", NoStrategy)
public object PinDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/pins/$MessageId", NoStrategy)
public object PinPut :
Route(HttpMethod.Put, "/channels/$ChannelId/pins/$MessageId", NoStrategy)
public object AllReactionsDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/messages/$MessageId/reactions", NoStrategy)
public object ChannelPermissionDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/permissions/$OverwriteId", NoStrategy)
public object ChannelPermissionPut :
Route(HttpMethod.Put, "/channels/$ChannelId/permissions/$OverwriteId", NoStrategy)
public object ReactionsGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/messages/$MessageId/reactions/$Emoji",
ListSerializer(DiscordUser.serializer())
)
public object NewsChannelFollow :
Route(
HttpMethod.Post,
"/channels/$ChannelId/followers",
FollowedChannelResponse.serializer()
)
public object TypingIndicatorPost :
Route(HttpMethod.Post, "/channels/$ChannelId/typing", NoStrategy)
public object GroupDMUserDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/recipients/$UserId", NoStrategy)
public object GroupDMUserPut :
Route(HttpMethod.Put, "/channels/$ChannelId/recipients/$UserId", NoStrategy)
public object EditMessagePatch :
Route(HttpMethod.Patch, "/channels/$ChannelId/messages/$MessageId", DiscordMessage.serializer())
public object StartPublicThreadWithMessagePost :
Route(
HttpMethod.Post,
"/channels/$ChannelId/messages/$MessageId/threads",
DiscordChannel.serializer()
)
public object StartThreadPost :
Route(HttpMethod.Post, "/channels/$ChannelId/threads", DiscordChannel.serializer())
public object JoinThreadPut :
Route(HttpMethod.Put, "/channels/$ChannelId/thread-members/@me", NoStrategy)
public object AddThreadMemberPut :
Route(HttpMethod.Put, "/channels/$ChannelId/thread-members/$UserId", NoStrategy)
public object LeaveThreadDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/thread-members/@me", NoStrategy)
public object RemoveUserFromThreadDelete :
Route(HttpMethod.Delete, "/channels/$ChannelId/thread-members/$UserId", NoStrategy)
public object ThreadMembersGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/thread-members",
ListSerializer(DiscordThreadMember.serializer())
)
public object PrivateThreadsGet : // TODO does this route still/even exist?
Route(
HttpMethod.Get,
"/channels/$ChannelId/threads/private",
ListThreadsResponse.serializer()
)
public object PrivateArchivedThreadsGet :
Route(
HttpMethod.Get,
"/channels/$ChannelId/threads/archived/private",
ListThreadsResponse.serializer()
)
public object PublicArchivedThreadsGet :
Route(
HttpMethod.Get,
"/channels/$ChannelId/threads/archived/public",
ListThreadsResponse.serializer()
)
public object JoinedPrivateArchivedThreadsGet :
Route(
HttpMethod.Get,
"/channels/$ChannelId/users/@me/threads/archived/private",
ListThreadsResponse.serializer()
)
/*
* Emoji:
* https://discord.com/developers/docs/resources/emoji
*/
public object GuildEmojiGet :
Route(HttpMethod.Get, "/guilds/$GuildId/emojis/$EmojiId", DiscordEmoji.serializer())
public object GuildEmojisGet :
Route>(HttpMethod.Get, "/guilds/$GuildId/emojis", ListSerializer(DiscordEmoji.serializer()))
public object GuildEmojiDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/emojis/$EmojiId", NoStrategy)
public object GuildEmojiPost :
Route(HttpMethod.Post, "/guilds/$GuildId/emojis", DiscordEmoji.serializer())
public object GuildEmojiPatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/emojis/$EmojiId", DiscordEmoji.serializer())
/*
* Invite:
* https://discord.com/developers/docs/resources/invite
*/
public object InviteGet :
Route(HttpMethod.Get, "/invites/$InviteCode", DiscordInvite.serializer())
public object InviteDelete :
Route(HttpMethod.Delete, "/invites/$InviteCode", DiscordInvite.serializer())
/*
* User:
* https://discord.com/developers/docs/resources/user
*/
public object CurrentUserGet :
Route(HttpMethod.Get, "/users/@me", DiscordUser.serializer())
public object CurrentUserPatch :
Route(HttpMethod.Patch, "/users/@me", DiscordUser.serializer())
public object UserGet :
Route(HttpMethod.Get, "/users/$UserId", DiscordUser.serializer())
public object CurrentUsersGuildsGet :
Route>(
HttpMethod.Get,
"/users/@me/guilds",
ListSerializer(DiscordPartialGuild.serializer())
)
public object GuildLeave :
Route(HttpMethod.Delete, "/users/@me/guilds/$GuildId", NoStrategy)
public object DMPost :
Route(HttpMethod.Post, "/users/@me/channels", DiscordChannel.serializer())
public object UserConnectionsGet :
Route>(HttpMethod.Get, "/users/@me/connections", ListSerializer(Connection.serializer()))
/*
* Guild:
* https://discord.com/developers/docs/resources/guild
*/
public object GuildPost :
Route(HttpMethod.Post, "/guilds", DiscordGuild.serializer())
public object GuildGet :
Route(HttpMethod.Get, "/guilds/$GuildId", DiscordGuild.serializer())
public object GuildPatch :
Route(HttpMethod.Patch, "/guilds/$GuildId", DiscordGuild.serializer())
public object GuildDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId", NoStrategy)
public object GuildChannelsGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/channels",
ListSerializer(DiscordChannel.serializer())
)
public object GuildChannelsPost :
Route(HttpMethod.Post, "/guilds/$GuildId/channels", DiscordChannel.serializer())
public object GuildChannelsPatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/channels", NoStrategy)
public object ActiveThreadsGet :
Route(HttpMethod.Get, "/guilds/$GuildId/threads/active", ListThreadsResponse.serializer())
public object GuildMemberGet :
Route(HttpMethod.Get, "/guilds/$GuildId/members/$UserId", DiscordGuildMember.serializer())
public object GuildMembersGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/members",
ListSerializer(DiscordGuildMember.serializer())
)
@KordExperimental
public object GuildMembersSearchGet : // https://github.com/discord/discord-api-docs/pull/1577
Route>(
HttpMethod.Get,
"/guilds/$GuildId/members/search",
ListSerializer(DiscordGuildMember.serializer())
)
public object GuildMemberPut :
Route(
HttpMethod.Put,
"/guilds/$GuildId/members/$UserId",
DiscordGuildMember.serializer().optional
)
public object GuildMemberPatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/members/$UserId", DiscordGuildMember.serializer())
public object GuildCurrentUserNickPatch :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/members/@me/nick",
CurrentUserNicknameModifyResponse.serializer()
)
public object GuildMemberRolePut :
Route(HttpMethod.Put, "/guilds/$GuildId/members/$UserId/roles/$RoleId", NoStrategy)
public object GuildMemberRoleDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/members/$UserId/roles/$RoleId", NoStrategy)
public object GuildMemberDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/members/$UserId", NoStrategy)
public object GuildBansGet :
Route>(HttpMethod.Get, "/guilds/$GuildId/bans", ListSerializer(BanResponse.serializer()))
public object GuildBanGet :
Route(HttpMethod.Get, "/guilds/$GuildId/bans/$UserId", BanResponse.serializer())
public object GuildBanPut :
Route(HttpMethod.Put, "/guilds/$GuildId/bans/$UserId", NoStrategy)
public object GuildBanDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/bans/$UserId", NoStrategy)
public object GuildRolesGet :
Route>(HttpMethod.Get, "/guilds/$GuildId/roles", ListSerializer(DiscordRole.serializer()))
public object GuildRolePost :
Route(HttpMethod.Post, "/guilds/$GuildId/roles", DiscordRole.serializer())
public object GuildRolesPatch :
Route>(HttpMethod.Patch, "/guilds/$GuildId/roles", ListSerializer(DiscordRole.serializer()))
public object GuildRolePatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/roles/$RoleId", DiscordRole.serializer())
public object GuildMFALevelModify :
Route(
HttpMethod.Post,
"/guilds/$GuildId/mfa",
GuildMFALevelModifyResponse.serializer(),
)
public object GuildRoleDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/roles/$RoleId", NoStrategy)
public object GuildPruneCountGet :
Route(HttpMethod.Get, "/guilds/$GuildId/prune", GetPruneResponse.serializer())
public object GuildPrunePost :
Route(HttpMethod.Post, "/guilds/$GuildId/prune", PruneResponse.serializer())
public object GuildVoiceRegionsGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/regions",
ListSerializer(DiscordVoiceRegion.serializer())
)
public object GuildInvitesGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/invites",
ListSerializer(DiscordInviteWithMetadata.serializer()),
)
public object GuildIntegrationGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/integrations",
ListSerializer(DiscordIntegration.serializer())
)
public object GuildIntegrationPost : // TODO does this endpoint still/even exist?
Route(HttpMethod.Post, "/guilds/$GuildId/integrations", NoStrategy)
public object GuildIntegrationPatch : // TODO does this endpoint still/even exist?
Route(HttpMethod.Patch, "/guilds/$GuildId/integrations/$IntegrationId", NoStrategy)
public object GuildIntegrationDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/integrations/$IntegrationId", NoStrategy)
public object GuildIntegrationSyncPost : // TODO does this endpoint still/even exist?
Route(HttpMethod.Post, "/guilds/$GuildId/integrations/$IntegrationId/sync", NoStrategy)
public object GuildWidgetGet :
Route(HttpMethod.Get, "/guilds/$GuildId/widget", DiscordGuildWidget.serializer())
public object GuildWidgetPatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/widget", DiscordGuildWidget.serializer())
public object GuildVanityInviteGet :
Route(HttpMethod.Get, "/guilds/$GuildId/vanity-url", DiscordPartialInvite.serializer())
public object GuildWelcomeScreenGet :
Route(
HttpMethod.Get,
"/guilds/$GuildId/welcome-screen",
DiscordWelcomeScreen.serializer()
)
public object GuildWelcomeScreenPatch :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/welcome-screen",
DiscordWelcomeScreen.serializer()
)
public object GuildPreviewGet :
Route(HttpMethod.Get, "/guilds/$GuildId/preview", DiscordGuildPreview.serializer())
public object GuildOnboardingGet :
Route(
HttpMethod.Get,
"/guilds/$GuildId/onboarding",
DiscordGuildOnboarding.serializer(),
)
public object GuildOnboardingModify :
Route(
HttpMethod.Put,
"/guilds/$GuildId/onboarding",
DiscordGuildOnboarding.serializer(),
)
public object SelfVoiceStatePatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/voice-states/@me", NoStrategy)
public object OthersVoiceStatePatch :
Route(HttpMethod.Patch, "/guilds/$GuildId/voice-states/$UserId", NoStrategy)
/*
* Webhook:
* https://discord.com/developers/docs/resources/webhook
*/
public object ChannelWebhooksGet :
Route>(
HttpMethod.Get,
"/channels/$ChannelId/webhooks",
ListSerializer(DiscordWebhook.serializer())
)
public object GuildWebhooksGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/webhooks",
ListSerializer(DiscordWebhook.serializer())
)
public object WebhookGet :
Route(HttpMethod.Get, "/webhooks/$WebhookId", DiscordWebhook.serializer())
public object WebhookPost :
Route(HttpMethod.Post, "/channels/$ChannelId/webhooks", DiscordWebhook.serializer())
public object WebhookByTokenGet :
Route(
HttpMethod.Get,
"/webhooks/$WebhookId/$WebhookToken",
DiscordWebhook.serializer(),
requiresAuthorizationHeader = false,
)
public object WebhookPatch :
Route(HttpMethod.Patch, "/webhooks/$WebhookId", DiscordWebhook.serializer())
public object WebhookByTokenPatch :
Route(
HttpMethod.Patch,
"/webhooks/$WebhookId/$WebhookToken",
DiscordWebhook.serializer(),
requiresAuthorizationHeader = false,
)
public object WebhookDelete :
Route(HttpMethod.Delete, "/webhooks/$WebhookId", NoStrategy)
public object WebhookByTokenDelete :
Route(
HttpMethod.Delete,
"/webhooks/$WebhookId/$WebhookToken",
NoStrategy,
requiresAuthorizationHeader = false,
)
public object ExecuteWebhookPost :
Route(
HttpMethod.Post,
"/webhooks/$WebhookId/$WebhookToken",
DiscordMessage.serializer().optional,
requiresAuthorizationHeader = false,
)
public object ExecuteSlackWebhookPost :
Route(
HttpMethod.Post,
"/webhooks/$WebhookId/$WebhookToken/slack",
NoStrategy,
requiresAuthorizationHeader = false,
)
public object ExecuteGithubWebhookPost :
Route(
HttpMethod.Post,
"/webhooks/$WebhookId/$WebhookToken/github",
NoStrategy,
requiresAuthorizationHeader = false,
)
public object GetWebhookMessage :
Route(
HttpMethod.Get,
"/webhooks/$WebhookId/$WebhookToken/messages/$MessageId",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object EditWebhookMessage :
Route(
HttpMethod.Patch,
"/webhooks/$WebhookId/$WebhookToken/messages/$MessageId",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object DeleteWebhookMessage :
Route(
HttpMethod.Delete,
"/webhooks/$WebhookId/$WebhookToken/messages/$MessageId",
NoStrategy,
requiresAuthorizationHeader = false,
)
/*
* Voice:
* https://discord.com/developers/docs/resources/voice
*/
public object VoiceRegionsGet :
Route>(
HttpMethod.Get,
"/voice/regions",
ListSerializer(DiscordVoiceRegion.serializer())
)
/*
* OAuth2:
* https://discord.com/developers/docs/topics/oauth2
*/
public object CurrentApplicationInfo :
Route(HttpMethod.Get, "/oauth2/applications/@me", DiscordApplication.serializer())
/*
* Guild Template:
* https://discord.com/developers/docs/resources/guild-template
*/
public object TemplateGet :
Route(HttpMethod.Get, "guilds/templates/$TemplateCode", DiscordTemplate.serializer())
public object GuildFromTemplatePost :
Route(HttpMethod.Post, "guilds/templates/$TemplateCode", DiscordGuild.serializer())
public object GuildTemplatesGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/templates",
ListSerializer(DiscordTemplate.serializer())
)
public object GuildTemplatePost :
Route(HttpMethod.Post, "/guilds/$GuildId/templates", DiscordTemplate.serializer())
public object TemplateSyncPut :
Route(HttpMethod.Put, "/guilds/$GuildId/templates/$TemplateCode", DiscordTemplate.serializer())
public object TemplatePatch :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/templates/$TemplateCode",
DiscordTemplate.serializer()
)
public object TemplateDelete :
Route(
HttpMethod.Delete,
"/guilds/$GuildId/templates/$TemplateCode",
DiscordTemplate.serializer()
)
/*
* Interactions - Application Commands:
* https://discord.com/developers/docs/interactions/application-commands
*/
public object GlobalApplicationCommandsGet :
Route>(
HttpMethod.Get,
"/applications/$ApplicationId/commands",
ListSerializer(DiscordApplicationCommand.serializer())
)
public object GlobalApplicationCommandCreate :
Route(
HttpMethod.Post,
"/applications/$ApplicationId/commands",
DiscordApplicationCommand.serializer()
)
public object GlobalApplicationCommandsCreate :
Route>(
HttpMethod.Put,
"/applications/$ApplicationId/commands",
ListSerializer(DiscordApplicationCommand.serializer())
)
public object GlobalApplicationCommandModify :
Route(
HttpMethod.Patch,
"/applications/$ApplicationId/commands/$CommandId",
DiscordApplicationCommand.serializer()
)
public object GlobalApplicationCommandGet :
Route(
HttpMethod.Get,
"/applications/$ApplicationId/commands/$CommandId",
DiscordApplicationCommand.serializer()
)
public object GlobalApplicationCommandDelete :
Route(HttpMethod.Delete, "/applications/$ApplicationId/commands/$CommandId", NoStrategy)
public object GuildApplicationCommandsGet :
Route>(
HttpMethod.Get,
"/applications/$ApplicationId/guilds/$GuildId/commands",
ListSerializer(DiscordApplicationCommand.serializer())
)
public object GuildApplicationCommandCreate :
Route(
HttpMethod.Post,
"/applications/$ApplicationId/guilds/$GuildId/commands",
DiscordApplicationCommand.serializer()
)
public object GuildApplicationCommandsCreate :
Route>(
HttpMethod.Put,
"/applications/$ApplicationId/guilds/$GuildId/commands",
ListSerializer(DiscordApplicationCommand.serializer())
)
public object GuildApplicationCommandModify :
Route(
HttpMethod.Patch,
"/applications/$ApplicationId/guilds/$GuildId/commands/$CommandId",
DiscordApplicationCommand.serializer()
)
public object GuildApplicationCommandGet :
Route(
HttpMethod.Get,
"/applications/$ApplicationId/guilds/$GuildId/commands/$CommandId",
DiscordApplicationCommand.serializer()
)
public object GuildApplicationCommandDelete :
Route(HttpMethod.Delete, "/applications/$ApplicationId/guilds/$GuildId/commands/$CommandId", NoStrategy)
public object GuildApplicationCommandPermissionsGet :
Route>(
HttpMethod.Get,
"/applications/$ApplicationId/guilds/$GuildId/commands/permissions",
ListSerializer(DiscordGuildApplicationCommandPermissions.serializer())
)
public object ApplicationCommandPermissionsGet :
Route(
HttpMethod.Get,
"/applications/$ApplicationId/guilds/$GuildId/commands/$CommandId/permissions",
DiscordGuildApplicationCommandPermissions.serializer()
)
/*
* Guild Scheduled Event:
* https://discord.com/developers/docs/resources/guild-scheduled-event
*/
public object GuildScheduledEventsGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/scheduled-events",
ListSerializer(DiscordGuildScheduledEvent.serializer())
)
public object GuildScheduledEventGet :
Route(
HttpMethod.Get,
"/guilds/$GuildId/scheduled-events/$ScheduledEventId",
DiscordGuildScheduledEvent.serializer()
)
public object GuildScheduledEventUsersGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/scheduled-events/$ScheduledEventId/users",
ListSerializer(GuildScheduledEventUsersResponse.serializer()),
)
public object GuildScheduledEventPatch :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/scheduled-events/$ScheduledEventId",
DiscordGuildScheduledEvent.serializer()
)
public object GuildScheduledEventDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/scheduled-events/$ScheduledEventId", NoStrategy)
public object GuildScheduledEventsPost :
Route(
HttpMethod.Post,
"/guilds/$GuildId/scheduled-events",
DiscordGuildScheduledEvent.serializer()
)
/*
* Interactions - Receiving and Responding:
* https://discord.com/developers/docs/interactions/receiving-and-responding
*/
public object InteractionResponseCreate :
Route(
HttpMethod.Post,
"/interactions/$InteractionId/$InteractionToken/callback",
NoStrategy,
requiresAuthorizationHeader = false,
)
public object OriginalInteractionResponseGet :
Route(
HttpMethod.Get,
"/webhooks/$ApplicationId/$InteractionToken/messages/@original",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object OriginalInteractionResponseModify :
Route(
HttpMethod.Patch,
"/webhooks/$ApplicationId/$InteractionToken/messages/@original",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object OriginalInteractionResponseDelete :
Route(
HttpMethod.Delete,
"/webhooks/$ApplicationId/$InteractionToken/messages/@original",
NoStrategy,
requiresAuthorizationHeader = false,
)
public object FollowupMessageCreate :
Route(
HttpMethod.Post,
"/webhooks/$ApplicationId/$InteractionToken",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object FollowupMessageGet :
Route(
HttpMethod.Get,
"/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object FollowupMessageModify :
Route(
HttpMethod.Patch,
"/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId",
DiscordMessage.serializer(),
requiresAuthorizationHeader = false,
)
public object FollowupMessageDelete :
Route(
HttpMethod.Delete,
"/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId",
NoStrategy,
requiresAuthorizationHeader = false,
)
/*
* Stage Instance:
* https://discord.com/developers/docs/resources/stage-instance
*/
public object StageInstanceGet :
Route(HttpMethod.Get, "/stage-instances/$ChannelId", DiscordStageInstance.serializer())
public object StageInstancePost :
Route(HttpMethod.Post, "/stage-instances", DiscordStageInstance.serializer())
public object StageInstancePatch :
Route(HttpMethod.Patch, "/stage-instances/$ChannelId", DiscordStageInstance.serializer())
public object StageInstanceDelete :
Route(HttpMethod.Delete, "/stage-instances/$ChannelId", NoStrategy)
/*
* Sticker:
* https://discord.com/developers/docs/resources/sticker
*/
public object StickerGet :
Route(HttpMethod.Get, "/stickers/$StickerId", DiscordMessageSticker.serializer())
public object NitroStickerPacks :
Route(
HttpMethod.Get,
"/sticker-packs",
NitroStickerPacksResponse.serializer(),
)
public object GuildStickersGet :
Route>(
HttpMethod.Get,
"/guilds/$GuildId/stickers",
ListSerializer(DiscordMessageSticker.serializer())
)
public object GuildStickerGet :
Route(
HttpMethod.Get,
"/guilds/$GuildId/stickers/$StickerId",
DiscordMessageSticker.serializer()
)
public object GuildStickerDelete :
Route(HttpMethod.Delete, "/guilds/$GuildId/stickers/$StickerId", NoStrategy)
public object GuildStickerPost :
Route(HttpMethod.Post, "/guilds/$GuildId/stickers", DiscordMessageSticker.serializer())
public object GuildStickerPatch :
Route(
HttpMethod.Patch,
"/guilds/$GuildId/stickers/$StickerId",
DiscordMessageSticker.serializer()
)
}