├── example
├── ios
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── Runner
│ │ ├── Runner-Bridging-Header.h
│ │ ├── Assets.xcassets
│ │ │ ├── LaunchImage.imageset
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ ├── README.md
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ ├── Main.storyboard
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── .gitignore
├── android
│ ├── gradle.properties
│ ├── app
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── settings.gradle
│ └── build.gradle
├── .metadata
├── lib
│ ├── webview_page.dart
│ └── main.dart
├── pubspec.yaml
├── README.md
├── .gitignore
├── test
│ └── widget_test.dart
├── analysis_options.yaml
└── pubspec.lock
├── .pubignore
├── lib
├── src
│ ├── models
│ │ ├── discord_overwrite_type.dart
│ │ ├── discord_status.dart
│ │ ├── discord_premium_type.dart
│ │ ├── discord_membership_state.dart
│ │ ├── discord_nsfw_level.dart
│ │ ├── discord_integration_expiration_behavior.dart
│ │ ├── discord_invite_target_type.dart
│ │ ├── discord_sticker_format_type.dart
│ │ ├── discord_guild_scheduled_event_privacy_level.dart
│ │ ├── discord_guild_scheduled_event_entity_type.dart
│ │ ├── discord_message_activity_type.dart
│ │ ├── discord_visibility_type.dart
│ │ ├── discord_video_quality_mode.dart
│ │ ├── discord_connection_visibility_type.dart
│ │ ├── discord_message_interaction_type.dart
│ │ ├── discord_mfa_level.dart
│ │ ├── discord_mention_type.dart
│ │ ├── discord_sticker_type.dart
│ │ ├── discord_message_notifications_level.dart
│ │ ├── discord_stage_privacy_level.dart
│ │ ├── discord_message_component_type.dart
│ │ ├── discord_explicit_content_filter_level.dart
│ │ ├── discord_embed_type.dart
│ │ ├── discord_guild_premium_tier.dart
│ │ ├── discord_verification_level.dart
│ │ ├── discord_activity_flag.dart
│ │ ├── discord_guild_scheduled_event_status.dart
│ │ ├── discord_system_channel_flag.dart
│ │ ├── discord_integration_account.dart
│ │ ├── discord_ban.dart
│ │ ├── discord_activity_button.dart
│ │ ├── discord_snowflake.dart
│ │ ├── discord_errors.dart
│ │ ├── discord_embed_provider.dart
│ │ ├── discord_activity_party.dart
│ │ ├── discord_followed_channel.dart
│ │ ├── discord_image_format.dart
│ │ ├── discord_guild_widget_settings.dart
│ │ ├── discord_message_type.dart
│ │ ├── discord_guild_scheduled_event_entity_metadata.dart
│ │ ├── discord_embed_field.dart
│ │ ├── discord_reaction.dart
│ │ ├── discord_api_scope.dart
│ │ ├── discord_embed_footer.dart
│ │ ├── discord_welcome_screen.dart
│ │ ├── discord_activity_secrets.dart
│ │ ├── discord_message_activity.dart
│ │ ├── discord_activity_type.dart
│ │ ├── discord_overwrite.dart
│ │ ├── discord_embed_video.dart
│ │ ├── discord_embed_image.dart
│ │ ├── discord_team.dart
│ │ ├── discord_embed_author.dart
│ │ ├── discord_embed_thumbnail.dart
│ │ ├── discord_activity_timestamps.dart
│ │ ├── discord_voice_region.dart
│ │ ├── discord_role_tags.dart
│ │ ├── discord_message_flag.dart
│ │ ├── discord_sticker_item.dart
│ │ ├── discord_channel_mention.dart
│ │ ├── discord_invite_stage_instance.dart
│ │ ├── discord_team_member.dart
│ │ ├── discord_thread_member.dart
│ │ ├── discord_welcome_screen_channel.dart
│ │ ├── discord_guild_scheduled_event_user.dart
│ │ ├── discord_channel_type.dart
│ │ ├── discord_invite_metadata.dart
│ │ ├── discord_activity_assets.dart
│ │ ├── discord_token_webhook.dart
│ │ ├── discord_integration_application.dart
│ │ ├── discord_authorization_information.dart
│ │ ├── discord_message_interaction.dart
│ │ ├── discord_role.dart
│ │ ├── discord_message_reference.dart
│ │ ├── discord_presence_update.dart
│ │ ├── discord_guild_widget.dart
│ │ ├── discord_emoji.dart
│ │ ├── discord_allowed_mentions.dart
│ │ ├── discord_attachment.dart
│ │ ├── discord_application_flag.dart
│ │ ├── discord_token.dart
│ │ ├── discord_stage_instance.dart
│ │ ├── discord_sticker_pack.dart
│ │ ├── discord_client_status.dart
│ │ ├── discord_thread_metadata.dart
│ │ ├── discord_connection.dart
│ │ ├── discord_audit_log_entry.dart
│ │ ├── discord_audit_log.dart
│ │ ├── discord_user_flag.dart
│ │ ├── discord_guild_template.dart
│ │ ├── discord_guild_preview.dart
│ │ ├── discord_optional_audit_entry_info.dart
│ │ ├── discord_voice_state.dart
│ │ ├── discord_embed.dart
│ │ ├── discord_guild_member.dart
│ │ ├── discord_sticker.dart
│ │ ├── discord_guild_feature.dart
│ │ ├── discord_webhook.dart
│ │ ├── discord_audit_log_change.dart
│ │ └── discord_invite.dart
│ ├── extensions
│ │ └── string_extensions.dart
│ ├── exceptions
│ │ └── discord_api_exceptions.dart
│ └── providers
│ │ └── discord_http_client.dart
└── discord_api.dart
├── CHANGELOG.md
├── .metadata
├── pubspec.yaml
├── .gitignore
├── test
└── discord_api_test.dart
├── .github
└── workflows
│ └── dart.yml
└── analysis_options.yaml
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/.pubignore:
--------------------------------------------------------------------------------
1 | # See https://dart.dev/tools/pub/publishing#what-files-are-published
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/src/models/discord_overwrite_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordOverwriteType {
2 | role,
3 | member,
4 | }
5 |
--------------------------------------------------------------------------------
/lib/src/models/discord_status.dart:
--------------------------------------------------------------------------------
1 | enum DiscordStatus {
2 | idle,
3 | dnd,
4 | online,
5 | offline,
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_premium_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordPremiumType {
2 | none,
3 | nitroClassic,
4 | nitro,
5 | }
6 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/lib/src/models/discord_membership_state.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMembershipState {
2 | none,
3 | invited,
4 | accepted,
5 | }
6 |
--------------------------------------------------------------------------------
/lib/src/models/discord_nsfw_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordNsfwLevel {
2 | default0,
3 | explicit,
4 | safe,
5 | ageRestricted,
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_integration_expiration_behavior.dart:
--------------------------------------------------------------------------------
1 | enum DiscordIntegrationExpirationBehavior {
2 | removeRole,
3 | kick,
4 | }
5 |
--------------------------------------------------------------------------------
/lib/src/models/discord_invite_target_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordInviteTargetType {
2 | unused,
3 | stream,
4 | embeddedApplication,
5 | }
6 |
--------------------------------------------------------------------------------
/lib/src/models/discord_sticker_format_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordStickerFormatType {
2 | unused,
3 | png,
4 | apng,
5 | lottie,
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_scheduled_event_privacy_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordGuildScheduledEventPrivacyLevel {
2 | unused,
3 | unused1,
4 | guildOnly,
5 | }
6 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_scheduled_event_entity_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordGuildScheduledEventEntityType {
2 | unused,
3 | stageInstance,
4 | voice,
5 | external,
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_message_activity_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMessageActivityType {
2 | unused,
3 | join,
4 | spectate,
5 | listen,
6 | unused4,
7 | joinRequest,
8 | }
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/lib/src/extensions/string_extensions.dart:
--------------------------------------------------------------------------------
1 | extension StringExtension on String {
2 | String capitalize() {
3 | return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/lib/src/models/discord_visibility_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordVisibilityType {
2 | /// invisible to everyone except the user themselves
3 | none,
4 |
5 | /// visible to everyone
6 | everyone,
7 | }
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeixDev/discord_api/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_video_quality_mode.dart:
--------------------------------------------------------------------------------
1 | enum DiscordVideoQualityMode {
2 | unused,
3 |
4 | /// Discord chooses the quality for optimal performance
5 | auto,
6 |
7 | /// 720p
8 | full,
9 | }
10 |
--------------------------------------------------------------------------------
/lib/src/models/discord_connection_visibility_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordConnectionVisibilityType {
2 | /// invisible to everyone except the user themselves
3 | none,
4 |
5 | /// visible to everyone
6 | everyone,
7 | }
8 |
--------------------------------------------------------------------------------
/lib/src/models/discord_message_interaction_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMessageInteractionType {
2 | unused,
3 | ping,
4 | applicationCommand,
5 | messageComponent,
6 | applicationCommandAutocomplete,
7 | modalSubmit,
8 | }
9 |
--------------------------------------------------------------------------------
/lib/src/models/discord_mfa_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMfaLevel {
2 | /// guild has no MFA/2FA requirement for moderation actions
3 | none,
4 |
5 | /// guild has a 2FA requirement for moderation actions
6 | elevated,
7 | }
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/src/models/discord_mention_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMentionType {
2 | /// controls role mentions
3 | roles,
4 |
5 | /// controls user mentions
6 | users,
7 |
8 | /// controls @everyone and @here mentions
9 | everyone,
10 | }
11 |
--------------------------------------------------------------------------------
/lib/src/exceptions/discord_api_exceptions.dart:
--------------------------------------------------------------------------------
1 | class DiscordApiException implements Exception {
2 | final String message;
3 |
4 | const DiscordApiException(this.message);
5 |
6 | @override
7 | String toString() => 'DiscordException: $message';
8 | }
9 |
--------------------------------------------------------------------------------
/lib/src/models/discord_sticker_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordStickerType {
2 | unused,
3 |
4 | /// an official sticker in a pack, part of Nitro or
5 | /// in a removed purchasable pack
6 | standard,
7 |
8 | /// a sticker upload to a Boosted guild for the guild's members
9 | guild,
10 | }
11 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/lib/src/models/discord_message_notifications_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMessageNotificationsLevel {
2 | /// members will receive notifications for all messages by default
3 | allMessages,
4 |
5 | /// members will receive notifications only for message that @mention them by default
6 | onlyMentions,
7 | }
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.1
2 |
3 | * Updated GitHub Links, as the repository was renamed from discord_api_flutter to discord_api.
4 | * Remove .pubignore file to include `/example` directory in the pub package
5 | * Gave the package a longer description in the `pubspec.yaml` file
6 |
7 | ## 0.1.0
8 |
9 | * **Initial Release**
10 |
--------------------------------------------------------------------------------
/lib/src/models/discord_stage_privacy_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordStagePrivacyLevel {
2 | unused,
3 |
4 | /// The stage instance is visible publicly. (deprecated)
5 | @Deprecated("Stages can't be publicly visible anymore")
6 | public,
7 |
8 | /// The stage instance is visible to only guild members.
9 | guildOnly,
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/src/models/discord_message_component_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordMessageComponentType {
2 | unused,
3 |
4 | /// A container for other components
5 | actionRow,
6 |
7 | /// A button object
8 | button,
9 |
10 | /// A select menu for picking from choices
11 | selectMenu,
12 |
13 | /// A text input object
14 | textInput,
15 | }
16 |
--------------------------------------------------------------------------------
/lib/src/models/discord_explicit_content_filter_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordExplicitContentFilterLevel {
2 | /// media content will not be scanned
3 | disabled,
4 |
5 | /// media content sent by members without roles will be scanned
6 | membersWithoutRoles,
7 |
8 | /// media content sent by all members will be scanned
9 | allMembers,
10 | }
11 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: db747aa1331bd95bc9b3874c842261ca2d302cd5
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: db747aa1331bd95bc9b3874c842261ca2d302cd5
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/lib/src/models/discord_embed_type.dart:
--------------------------------------------------------------------------------
1 | enum DiscordEmbedType {
2 | /// generic embed rendered from embed attributes
3 | rich,
4 |
5 | /// image embed
6 | image,
7 |
8 | /// video embed
9 | video,
10 |
11 | /// animated gif image embed rendered as a video embed
12 | gifv,
13 |
14 | /// article embed
15 | article,
16 |
17 | /// link embed
18 | link,
19 | }
20 |
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_premium_tier.dart:
--------------------------------------------------------------------------------
1 | enum DiscordGuildPremiumTier {
2 | /// guild has not unlocked any Server Boost perks
3 | none,
4 |
5 | /// guild has unlocked the Server Boost level 1 perks
6 | tier1,
7 |
8 | /// guild has unlocked the Server Boost level 2 perks
9 | tier2,
10 |
11 | /// guild has unlocked the Server Boost level 3 perks
12 | tier3,
13 | }
14 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/lib/src/models/discord_verification_level.dart:
--------------------------------------------------------------------------------
1 | enum DiscordVerificationLevel {
2 | /// unrestricted
3 | none,
4 |
5 | /// must have verified email on account
6 | low,
7 |
8 | /// must be registered on Discord for longer than 5 minutes
9 | medium,
10 |
11 | /// must be a member of the server for longer than 10 minutes
12 | high,
13 |
14 | /// must have a verified phone number
15 | veryHigh,
16 | }
17 |
--------------------------------------------------------------------------------
/example/lib/webview_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
3 |
4 | class WebViewPage extends StatelessWidget {
5 | final String url;
6 |
7 | const WebViewPage(this.url, {Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return WebviewScaffold(appBar: AppBar(), url: url);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/src/models/discord_activity_flag.dart:
--------------------------------------------------------------------------------
1 | enum DiscordActivityFlag {
2 | /// 1 << 0
3 | instance,
4 |
5 | /// 1 << 1
6 | join,
7 |
8 | /// 1 << 2
9 | spectate,
10 |
11 | /// 1 << 3
12 | joinRequest,
13 |
14 | /// 1 << 4
15 | sync,
16 |
17 | /// 1 << 5
18 | play,
19 |
20 | /// 1 << 6
21 | partyPrivacyFriends,
22 |
23 | /// 1 << 7
24 | partyPrivacyVoiceChannel,
25 |
26 | /// 1 << 8
27 | embedded,
28 | }
29 |
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_scheduled_event_status.dart:
--------------------------------------------------------------------------------
1 | /// Once `status` is set to `COMPLETED` or `CANCELED`,
2 | /// the `status` can no longer be updated.
3 | ///
4 | /// **Valid Guild Scheduled Event Status Transitions** \
5 | /// SCHEDULED --> ACTIVE \
6 | /// ACTIVE --------> COMPLETED \
7 | /// SCHEDULED --> CANCELED
8 | enum DiscordGuildScheduledEventStatus {
9 | unused,
10 | scheduled,
11 | active,
12 | completed,
13 | canceled,
14 | }
15 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: discord_api
2 | description: A pure dart package wrapping the discord API, including transformers for all its objects.
3 | version: 0.1.1
4 | homepage: https://github.com/MeixDev/discord_api
5 | repository: https://github.com/MeixDev/discord_api
6 |
7 | environment:
8 | sdk: '>=2.15.0 <3.0.0'
9 |
10 | dependencies:
11 | dio: ^4.0.4
12 |
13 | dev_dependencies:
14 | coverage: ^1.1.0
15 | http_mock_adapter: ^0.3.2
16 | lint: ^1.8.2
17 | test: ^1.20.1
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 |
4 | publish_to: 'none'
5 |
6 | version: 1.0.0+1
7 |
8 | environment:
9 | sdk: ">=2.16.1 <3.0.0"
10 |
11 | dependencies:
12 | cupertino_icons: ^1.0.2
13 | flutter:
14 | sdk: flutter
15 | discord_api:
16 | path: ../
17 |
18 | dev_dependencies:
19 | flutter_test:
20 | sdk: flutter
21 |
22 | flutter_webview_plugin: ^0.4.0
23 | flutter_lints: ^1.0.0
24 |
25 | flutter:
26 |
27 | uses-material-design: true
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/src/models/discord_system_channel_flag.dart:
--------------------------------------------------------------------------------
1 | enum DiscordSystemChannelFlag {
2 | /// 1 << 0
3 | ///
4 | /// Suppress member join notifications
5 | suppressJoinNotifications,
6 |
7 | /// 1 << 1
8 | ///
9 | /// Suppress server boost notifications
10 | suppressPremiumSubscriptions,
11 |
12 | /// 1 << 2
13 | ///
14 | /// Suppress server setup tips
15 | suppressGuildReminderNotifications,
16 |
17 | /// 1 << 3
18 | ///
19 | /// Hide member join sticker reply buttons
20 | suppressJoinNotificationReplies,
21 | }
22 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/src/models/discord_integration_account.dart:
--------------------------------------------------------------------------------
1 | class DiscordIntegrationAccount {
2 | /// id of the account
3 | final String id;
4 |
5 | /// name of the account
6 | final String name;
7 |
8 | static const idEntry = 'id';
9 | static const nameEntry = 'name';
10 |
11 | DiscordIntegrationAccount({
12 | required this.id,
13 | required this.name,
14 | });
15 |
16 | factory DiscordIntegrationAccount.fromJson(Map json) {
17 | return DiscordIntegrationAccount(
18 | id: json[idEntry] as String,
19 | name: json[nameEntry] as String,
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/lib/src/models/discord_ban.dart:
--------------------------------------------------------------------------------
1 | import 'discord_user.dart';
2 |
3 | class DiscordBan {
4 | // the reason for the ban
5 | final String? reason;
6 |
7 | /// the banned user
8 | final DiscordUser user;
9 |
10 | static const reasonEntry = 'reason';
11 | static const userEntry = 'user';
12 |
13 | DiscordBan({
14 | this.reason,
15 | required this.user,
16 | });
17 |
18 | factory DiscordBan.fromJson(Map json) {
19 | return DiscordBan(
20 | reason: json[reasonEntry] as String?,
21 | user: DiscordUser.fromJson(json[userEntry] as Map),
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | .fvm/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
--------------------------------------------------------------------------------
/lib/src/models/discord_activity_button.dart:
--------------------------------------------------------------------------------
1 | class DiscordActivityButton {
2 | /// the text shown on the button (1-32 characters)
3 | final String label;
4 |
5 | /// the url opened when clicking the button (1-512 characters)
6 | final String url;
7 |
8 | static const labelEntry = 'label';
9 | static const urlEntry = 'url';
10 |
11 | DiscordActivityButton({
12 | required this.label,
13 | required this.url,
14 | });
15 |
16 | factory DiscordActivityButton.fromJson(Map json) =>
17 | DiscordActivityButton(
18 | label: json[labelEntry] as String,
19 | url: json[urlEntry] as String,
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/lib/src/models/discord_snowflake.dart:
--------------------------------------------------------------------------------
1 | class DiscordSnowflake {
2 | final int timestamp;
3 | late final DateTime? _timestampAsDateTime;
4 |
5 | final int workerId;
6 | final int processId;
7 | final int increment;
8 |
9 | final String snowflake;
10 |
11 | DiscordSnowflake(this.snowflake)
12 | : timestamp = (int.parse(snowflake) >> 22) + 1420070400000,
13 | workerId = (int.parse(snowflake) & 0x3E0000) >> 17,
14 | processId = (int.parse(snowflake) & 0x1F000) >> 12,
15 | increment = int.parse(snowflake) & 0xFFF;
16 |
17 | DateTime get timestampAsDateTime =>
18 | _timestampAsDateTime ??= DateTime.fromMillisecondsSinceEpoch(timestamp);
19 | }
20 |
--------------------------------------------------------------------------------
/lib/src/models/discord_errors.dart:
--------------------------------------------------------------------------------
1 | class DiscordErrors {
2 | /// The error code sent by Discord.
3 | final int code;
4 |
5 | /// The specification of the error. Differs from error type to error type.
6 | final Map errors;
7 |
8 | /// An human readable error message.
9 | final String message;
10 |
11 | DiscordErrors({
12 | required this.code,
13 | required this.message,
14 | required this.errors,
15 | });
16 |
17 | factory DiscordErrors.fromJson(Map json) => DiscordErrors(
18 | code: json['code'] as int,
19 | message: json['message'] as String,
20 | errors: json['errors'] as Map,
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/lib/src/models/discord_embed_provider.dart:
--------------------------------------------------------------------------------
1 | class DiscordEmbedProvider {
2 | /// name of provider
3 | ///
4 | /// is not always returned, hence the nullable property
5 | final String? name;
6 |
7 | /// url of provider
8 | ///
9 | /// is not always returned, hence the nullable property
10 | final String? url;
11 |
12 | static const nameEntry = 'name';
13 | static const urlEntry = 'url';
14 |
15 | DiscordEmbedProvider({
16 | this.name,
17 | this.url,
18 | });
19 |
20 | factory DiscordEmbedProvider.fromJson(Map json) =>
21 | DiscordEmbedProvider(
22 | name: json[nameEntry] as String?,
23 | url: json[urlEntry] as String?,
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/test/discord_api_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:discord_api/src/discord_cdn_helper.dart';
2 | import 'package:test/test.dart';
3 |
4 | void main() {
5 | final cdn = DiscordCdnHelper.instance;
6 |
7 | group('DiscordCdnHelper tests', () {
8 | test("Get 131492741409538048's Avatar in size 64", () {
9 | final value = cdn.getUserAvatar(
10 | userId: "131492741409538048",
11 | userAvatarHash: "64d4f5dfcb00059794c20f656cb19c2b",
12 | size: 64,
13 | );
14 | expect(value, isNotNull);
15 | expect(
16 | value,
17 | "https://cdn.discordapp.com/avatars/131492741409538048/64d4f5dfcb00059794c20f656cb19c2b.png?size=64",
18 | );
19 | });
20 | });
21 | }
22 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/lib/src/models/discord_activity_party.dart:
--------------------------------------------------------------------------------
1 | class DiscordActivityParty {
2 | /// the id of the party
3 | ///
4 | /// is not always returned, hence the nullable property
5 | final String? id;
6 |
7 | /// used to show the party's current and maximum size
8 | ///
9 | /// is an array of two integers (current_size, max_size)
10 | final List? size;
11 |
12 | static const idEntry = "id";
13 | static const sizeEntry = "size";
14 |
15 | DiscordActivityParty({
16 | this.id,
17 | this.size,
18 | });
19 |
20 | factory DiscordActivityParty.fromJson(Map json) =>
21 | DiscordActivityParty(
22 | id: json[idEntry] as String?,
23 | size: List.from(json[sizeEntry] as List),
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/lib/src/models/discord_followed_channel.dart:
--------------------------------------------------------------------------------
1 | import 'discord_snowflake.dart';
2 |
3 | class DiscordFollowedChannel {
4 | /// source channel id
5 | final DiscordSnowflake channelId;
6 |
7 | /// created target webhook id
8 | final DiscordSnowflake webhookId;
9 |
10 | static const channelIdEntry = 'channel_id';
11 | static const webhookIdEntry = 'webhook_id';
12 |
13 | DiscordFollowedChannel({
14 | required this.channelId,
15 | required this.webhookId,
16 | });
17 |
18 | factory DiscordFollowedChannel.fromJson(Map json) =>
19 | DiscordFollowedChannel(
20 | channelId: DiscordSnowflake(json[channelIdEntry] as String),
21 | webhookId: DiscordSnowflake(json[webhookIdEntry] as String),
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/lib/src/models/discord_image_format.dart:
--------------------------------------------------------------------------------
1 | enum DiscordImageFormat {
2 | jpeg,
3 | png,
4 | webp,
5 | gif,
6 | lottie,
7 | }
8 |
9 | DiscordImageFormat discordImageFormatFromValue(String s) {
10 | return DiscordImageFormat.values
11 | .firstWhere((element) => element.fileExtension == s);
12 | }
13 |
14 | extension ToFileExtension on DiscordImageFormat {
15 | String get fileExtension {
16 | switch (this) {
17 | case DiscordImageFormat.jpeg:
18 | return 'jpg';
19 | case DiscordImageFormat.png:
20 | return 'png';
21 | case DiscordImageFormat.webp:
22 | return 'webp';
23 | case DiscordImageFormat.gif:
24 | return 'gif';
25 | case DiscordImageFormat.lottie:
26 | return 'json';
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_widget_settings.dart:
--------------------------------------------------------------------------------
1 | import 'discord_snowflake.dart';
2 |
3 | class DiscordGuildWidgetSettings {
4 | /// whether the widget is enabled
5 | final bool enabled;
6 |
7 | /// the widget channel id
8 | final DiscordSnowflake? channelId;
9 |
10 | static const enabledEntry = 'enabled';
11 | static const channelIdEntry = 'channel_id';
12 |
13 | const DiscordGuildWidgetSettings({
14 | required this.enabled,
15 | this.channelId,
16 | });
17 |
18 | factory DiscordGuildWidgetSettings.fromJson(Map json) {
19 | return DiscordGuildWidgetSettings(
20 | enabled: json[enabledEntry] as bool,
21 | channelId: json[channelIdEntry] != null
22 | ? DiscordSnowflake(json[channelIdEntry] as String)
23 | : null,
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/src/models/discord_message_type.dart:
--------------------------------------------------------------------------------
1 | /// Type 19 and 20 are only in API v8. In v6, they are still type 0.
2 | /// Type 21 is only in API v9.
3 | enum DiscordMessageType {
4 | default0,
5 | recipientAdd,
6 | recipientRemove,
7 | call,
8 | channelNameChange,
9 | channelIconChange,
10 | channelPinnedMessage,
11 | guildMemberJoin,
12 | userPremiumGuildSubscription,
13 | userPremiumGuildSubscriptionTier1,
14 | userPremiumGuildSubscriptionTier2,
15 | userPremiumGuildSubscriptionTier3,
16 | channelFollowAdd,
17 | guildDiscoveryDisqualified,
18 | guildDiscoveryRequalified,
19 | guildDiscoveryGracePeriodInitialWarning,
20 | guildDiscoveryGracePeriodFinalWarning,
21 | threadCreated,
22 | reply,
23 | chatInputCommand,
24 | threadStarterMessage,
25 | guildInviteReminder,
26 | contextMenuCommand,
27 | }
28 |
--------------------------------------------------------------------------------
/lib/src/models/discord_guild_scheduled_event_entity_metadata.dart:
--------------------------------------------------------------------------------
1 | class DiscordGuildScheduledEventEntityMetadata {
2 | /// location of the event (1-100 characters)
3 | ///
4 | /// [required](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) for events with 'entity_type': EXTERNAL
5 | ///
6 | /// is not always returned, hence the nullable property
7 | final String? location;
8 |
9 | static const locationEntry = 'location';
10 |
11 | DiscordGuildScheduledEventEntityMetadata({
12 | this.location,
13 | });
14 |
15 | factory DiscordGuildScheduledEventEntityMetadata.fromJson(
16 | Map json,
17 | ) =>
18 | DiscordGuildScheduledEventEntityMetadata(
19 | location: json[locationEntry] as String?,
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/lib/src/models/discord_embed_field.dart:
--------------------------------------------------------------------------------
1 | class DiscordEmbedField {
2 | /// name of the field
3 | final String name;
4 |
5 | /// value of the field
6 | final String value;
7 |
8 | /// whether or not this field should display inline
9 | ///
10 | /// is not always returned, hence the nullable property
11 | final bool? inline;
12 |
13 | static const nameEntry = 'name';
14 | static const valueEntry = 'value';
15 | static const inlineEntry = 'inline';
16 |
17 | DiscordEmbedField({
18 | required this.name,
19 | required this.value,
20 | this.inline,
21 | });
22 |
23 | factory DiscordEmbedField.fromJson(Map json) =>
24 | DiscordEmbedField(
25 | name: json[nameEntry] as String,
26 | value: json[valueEntry] as String,
27 | inline: json[inlineEntry] as bool?,
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/lib/src/models/discord_reaction.dart:
--------------------------------------------------------------------------------
1 | import 'discord_emoji.dart';
2 |
3 | class DiscordReaction {
4 | /// times this emoji has been used to react
5 | final int count;
6 |
7 | /// whether the current user reacted using this emoji
8 | final bool me;
9 |
10 | /// emoji information
11 | final DiscordEmoji emoji;
12 |
13 | static const countEntry = 'count';
14 | static const meEntry = 'me';
15 | static const emojiEntry = 'emoji';
16 |
17 | DiscordReaction({
18 | required this.count,
19 | required this.me,
20 | required this.emoji,
21 | });
22 |
23 | factory DiscordReaction.fromJson(Map json) =>
24 | DiscordReaction(
25 | count: json[countEntry] as int,
26 | me: json[meEntry] as bool,
27 | emoji: DiscordEmoji.fromJson(json[emojiEntry] as Map),
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/lib/src/models/discord_api_scope.dart:
--------------------------------------------------------------------------------
1 | enum DiscordApiScope {
2 | activitiesRead,
3 | activitiesWrite,
4 | applicationsBuildsRead,
5 | applicationsBuildsUpload,
6 | applicationsCommands,
7 | applicationsCommandsUpdate,
8 | applicationsEntitlements,
9 | applicationsStoreUpdate,
10 | bot,
11 | connections,
12 | email,
13 | gdmJoin,
14 | guilds,
15 | guildsJoin,
16 | guilsMembersRead,
17 | identify,
18 | messagesRead,
19 | rpc,
20 | rpcActivitiesWrite,
21 | rpcNotificationsRead,
22 | rpcVoiceRead,
23 | rpcVoiceWrite,
24 | webhookIncoming,
25 | }
26 |
27 | extension DiscordApiScopeModifier on DiscordApiScope {
28 | String get string {
29 | final RegExp regExp = RegExp('(?<=[a-z])[A-Z]');
30 | return name
31 | .replaceAllMapped(regExp, (match) => '.${match.group(0)}')
32 | .toLowerCase();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 | /windows/*
34 | /web/*
35 |
36 | # Web related
37 | lib/generated_plugin_registrant.dart
38 |
39 | # Symbolication related
40 | app.*.symbols
41 |
42 | # Obfuscation related
43 | app.*.map.json
44 |
45 | # Android Studio will place build artifacts here
46 | /android/app/debug
47 | /android/app/profile
48 | /android/app/release
49 |
--------------------------------------------------------------------------------
/lib/src/models/discord_embed_footer.dart:
--------------------------------------------------------------------------------
1 | class DiscordEmbedFooter {
2 | /// footer text
3 | final String text;
4 |
5 | /// url of footer icon (only supports http(s) and attachments)
6 | ///
7 | /// is not always returned, hence the nullable property
8 | final String? iconUrl;
9 |
10 | /// a proxied url of footer icon
11 | ///
12 | /// is not always returned, hence the nullable property
13 | final String? proxyIconUrl;
14 |
15 | static const textEntry = 'text';
16 | static const iconUrlEntry = 'icon_url';
17 | static const proxyIconUrlEntry = 'proxy_icon_url';
18 |
19 | DiscordEmbedFooter({
20 | required this.text,
21 | this.iconUrl,
22 | this.proxyIconUrl,
23 | });
24 |
25 | factory DiscordEmbedFooter.fromJson(Map json) =>
26 | DiscordEmbedFooter(
27 | text: json[textEntry] as String,
28 | iconUrl: json[iconUrlEntry] as String?,
29 | proxyIconUrl: json[proxyIconUrlEntry] as String?,
30 | );
31 | }
32 |
--------------------------------------------------------------------------------
/lib/src/models/discord_welcome_screen.dart:
--------------------------------------------------------------------------------
1 | import 'discord_welcome_screen_channel.dart';
2 |
3 | class DiscordWelcomeScreen {
4 | /// the server description shown in the welcome screen
5 | ///
6 | /// can be null
7 | final String? description;
8 |
9 | /// the channels shown in the welcome screen, up to 5
10 | final List welcomeChannels;
11 |
12 | static const descriptionEntry = 'description';
13 | static const welcomeChannelsEntry = 'welcome_channels';
14 |
15 | DiscordWelcomeScreen({
16 | this.description,
17 | required this.welcomeChannels,
18 | });
19 |
20 | factory DiscordWelcomeScreen.fromJson(Map json) =>
21 | DiscordWelcomeScreen(
22 | description: json[descriptionEntry] as String?,
23 | welcomeChannels: List.from(
24 | (json[welcomeChannelsEntry] as List