Skip to content

Commit

Permalink
make everything public
Browse files Browse the repository at this point in the history
  • Loading branch information
0b10011 committed May 25, 2024
1 parent 5724489 commit db64afc
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 205 deletions.
10 changes: 5 additions & 5 deletions src/gateway/events/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ pub struct Activity {
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct ActivityEmoji {
name: String,
id: Option<String>,
animated: Option<bool>,
pub name: String,
pub id: Option<String>,
pub animated: Option<bool>,
}

#[cfg_attr(feature = "clone", derive(Clone))]
Expand All @@ -42,9 +42,9 @@ pub struct ActivityTimestamps {
#[cfg_attr(feature = "serde", serde(default))]
// #[cfg_attr(feature = "serde", serde(with = "time::serde::timestamp::milliseconds::option"))]
// i128 is broken with this
start: Option<usize>,
pub start: Option<usize>,
#[cfg_attr(feature = "serde", serde(default))]
// #[cfg_attr(feature = "serde", serde(with = "time::serde::timestamp::milliseconds::option"))]
// i128 is broken with this
end: Option<usize>,
pub end: Option<usize>,
}
26 changes: 14 additions & 12 deletions src/gateway/events/guild/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use time::{serde::iso8601, OffsetDateTime};
#[cfg(feature = "serde")]
use time::serde::iso8601;
use time::OffsetDateTime;

use crate::resources::{
channel::Channel,
Expand All @@ -26,15 +28,15 @@ pub enum GuildCreate {
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct GuildCreateExtraFields {
#[cfg_attr(feature = "serde", serde(with = "iso8601"))]
joined_at: OffsetDateTime,
large: bool,
unavailable: Option<bool>,
member_count: usize,
voice_states: Vec<VoiceState>,
members: Vec<GuildMember>,
channels: Option<Vec<Channel>>,
threads: Vec<Channel>,
presences: Vec<PresenceUpdate>,
stage_instances: Vec<StageInstance>,
guild_scheduled_events: Vec<GuildScheduledEvent>,
pub joined_at: OffsetDateTime,
pub large: bool,
pub unavailable: Option<bool>,
pub member_count: usize,
pub voice_states: Vec<VoiceState>,
pub members: Vec<GuildMember>,
pub channels: Option<Vec<Channel>>,
pub threads: Vec<Channel>,
pub presences: Vec<PresenceUpdate>,
pub stage_instances: Vec<StageInstance>,
pub guild_scheduled_events: Vec<GuildScheduledEvent>,
}
18 changes: 9 additions & 9 deletions src/gateway/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ pub struct Unimplemented {}
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Ready {
v: usize,
user: User,
guilds: Vec<UnavailableGuild>,
session_id: String,
resume_gateway_url: String,
shard: Option<(usize, usize)>,
application: UnavailableApplication,
pub v: usize,
pub user: User,
pub guilds: Vec<UnavailableGuild>,
pub session_id: String,
pub resume_gateway_url: String,
pub shard: Option<(usize, usize)>,
pub application: UnavailableApplication,
}

#[cfg_attr(feature = "clone", derive(Clone))]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct UnavailableApplication {
id: String,
flags: ApplicationFlags,
pub id: String,
pub flags: ApplicationFlags,
}
30 changes: 16 additions & 14 deletions src/gateway/events/voice.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use time::{serde::iso8601, OffsetDateTime};
#[cfg(feature = "serde")]
use time::serde::iso8601;
use time::OffsetDateTime;

use crate::resources::guild::GuildMember;

Expand All @@ -9,18 +11,18 @@ use crate::resources::guild::GuildMember;
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct VoiceState {
guild_id: Option<String>,
channel_id: Option<String>,
user_id: String,
member: Option<GuildMember>,
session_id: String,
deaf: bool,
mute: bool,
self_deaf: bool,
self_mute: bool,
self_stream: Option<bool>,
self_video: bool,
suppress: bool,
pub guild_id: Option<String>,
pub channel_id: Option<String>,
pub user_id: String,
pub member: Option<GuildMember>,
pub session_id: String,
pub deaf: bool,
pub mute: bool,
pub self_deaf: bool,
pub self_mute: bool,
pub self_stream: Option<bool>,
pub self_video: bool,
pub suppress: bool,
#[cfg_attr(feature = "serde", serde(with = "iso8601"))]
request_to_speak_timestamp: OffsetDateTime,
pub request_to_speak_timestamp: OffsetDateTime,
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(warnings)]

#[cfg(feature = "gateway")]
pub mod gateway;

Expand Down
72 changes: 36 additions & 36 deletions src/resources/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,54 @@ use super::{
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Application {
id: ApplicationId,
name: String,
icon: Option<ImageHash>,
description: String,
pub id: ApplicationId,
pub name: String,
pub icon: Option<ImageHash>,
pub description: String,
#[cfg_attr(feature = "serde", serde(default))]
rpc_origins: Vec<Url>,
bot_public: bool,
bot_require_code_grant: bool,
pub rpc_origins: Vec<Url>,
pub bot_public: bool,
pub bot_require_code_grant: bool,
#[cfg_attr(feature = "serde", serde(default))]
bot: Option<UnavailableUser>,
pub bot: Option<UnavailableUser>,
#[cfg_attr(feature = "serde", serde(default))]
terms_of_service_url: Option<Url>,
pub terms_of_service_url: Option<Url>,
#[cfg_attr(feature = "serde", serde(default))]
privacy_policy_url: Option<Url>,
pub privacy_policy_url: Option<Url>,
#[cfg_attr(feature = "serde", serde(default))]
owner: Option<UnavailableUser>,
pub owner: Option<UnavailableUser>,
/// Deprecated and always an empty string.
summary: String,
verify_key: String,
team: Option<Team>,
pub summary: String,
pub verify_key: String,
pub team: Option<Team>,
#[cfg_attr(feature = "serde", serde(default))]
guild_id: Option<GuildId>,
pub guild_id: Option<GuildId>,
#[cfg_attr(feature = "serde", serde(default))]
guild: Option<UnavailableGuild>,
pub guild: Option<UnavailableGuild>,
#[cfg_attr(feature = "serde", serde(default))]
primary_sku_id: Option<SkuId>,
pub primary_sku_id: Option<SkuId>,
#[cfg_attr(feature = "serde", serde(default))]
slug: Option<Url>,
pub slug: Option<Url>,
#[cfg_attr(feature = "serde", serde(default))]
cover_image: Option<ImageHash>,
pub cover_image: Option<ImageHash>,
#[cfg_attr(feature = "serde", serde(default))]
flags: Option<ApplicationFlags>,
pub flags: Option<ApplicationFlags>,
#[cfg_attr(feature = "serde", serde(default))]
approximate_guild_count: Option<usize>,
pub approximate_guild_count: Option<usize>,
#[cfg_attr(feature = "serde", serde(default))]
redirect_uris: Vec<Url>,
pub redirect_uris: Vec<Url>,
#[cfg_attr(feature = "serde", serde(default))]
interactions_endpoint_url: Option<Url>,
pub interactions_endpoint_url: Option<Url>,
#[cfg_attr(feature = "serde", serde(default))]
role_connections_verification_url: Option<Url>,
pub role_connections_verification_url: Option<Url>,
#[cfg_attr(feature = "serde", serde(default))]
tags: Vec<Tag>,
pub tags: Vec<Tag>,
#[cfg_attr(feature = "serde", serde(default))]
install_params: Option<InstallParams>,
pub install_params: Option<InstallParams>,
#[cfg_attr(feature = "serde", serde(default))]
integration_types_config: Option<IntegrationTypesConfigurationMap>,
pub integration_types_config: Option<IntegrationTypesConfigurationMap>,
#[cfg_attr(feature = "serde", serde(default))]
custom_install_url: Option<Url>,
pub custom_install_url: Option<Url>,
}

#[cfg_attr(feature = "clone", derive(Clone))]
Expand All @@ -78,8 +78,8 @@ pub enum IntegrationType {
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct IntegrationTypesConfigurationMap {
guild_install: IntegrationTypeConfiguration,
user_install: IntegrationTypeConfiguration,
pub guild_install: IntegrationTypeConfiguration,
pub user_install: IntegrationTypeConfiguration,
}

/// Discord docs: https://discord.com/developers/docs/resources/application#application-object-application-integration-type-configuration-object
Expand All @@ -88,31 +88,31 @@ pub struct IntegrationTypesConfigurationMap {
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct IntegrationTypeConfiguration {
#[cfg_attr(feature = "serde", serde(default))]
oauth2_install_params: Option<InstallParams>,
pub oauth2_install_params: Option<InstallParams>,
}

#[cfg_attr(feature = "clone", derive(Clone))]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Tag(String);
pub struct Tag(pub String);

#[cfg_attr(feature = "clone", derive(Clone))]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct SkuId(String);
pub struct SkuId(pub String);

#[cfg_attr(feature = "clone", derive(Clone))]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct ApplicationId(String);
pub struct ApplicationId(pub String);

/// Discord docs: https://discord.com/developers/docs/resources/application#install-params-object
#[cfg_attr(feature = "clone", derive(Clone))]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct InstallParams {
scopes: Scopes,
permissions: Permissions,
pub scopes: Scopes,
pub permissions: Permissions,
}

/// https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes
Expand Down
Loading

0 comments on commit db64afc

Please sign in to comment.