Rustdoc warnings + misc changes

This commit is contained in:
kozabrada123 2023-07-10 18:06:45 +02:00
parent 322894e4e9
commit 18ac7b5708
44 changed files with 147 additions and 181 deletions

View File

@ -20,7 +20,7 @@ impl Instance {
/// ///
/// # Errors /// # Errors
/// ///
/// * [`ChorusLibError`] - If the server does not respond. /// * [`crate::errors::ChorusError`] - If the server does not respond.
pub async fn register_account( pub async fn register_account(
&mut self, &mut self,
register_schema: &RegisterSchema, register_schema: &RegisterSchema,

View File

@ -4,6 +4,7 @@ use reqwest::{multipart, Client};
use serde_json::to_string; use serde_json::to_string;
use crate::api::LimitType; use crate::api::LimitType;
use crate::errors::ChorusResult;
use crate::instance::UserMeta; use crate::instance::UserMeta;
use crate::ratelimiter::ChorusRequest; use crate::ratelimiter::ChorusRequest;
use crate::types::{Message, MessageSendSchema, PartialDiscordFileAttachment, Snowflake}; use crate::types::{Message, MessageSendSchema, PartialDiscordFileAttachment, Snowflake};
@ -13,17 +14,14 @@ impl Message {
/// # Arguments /// # Arguments
/// * `url_api` - The URL of the Spacebar server's API. /// * `url_api` - The URL of the Spacebar server's API.
/// * `message` - The [`Message`] that will be sent to the Spacebar server. /// * `message` - The [`Message`] that will be sent to the Spacebar server.
/// * `limits_user` - The [`Limits`] of the user.
/// * `limits_instance` - The [`Limits`] of the instance.
/// * `requester` - The [`LimitedRequester`] that will be used to make requests to the Spacebar server.
/// # Errors /// # Errors
/// * [`ChorusLibError`] - If the message cannot be sent. /// * [`crate::errors::ChorusError`] - If the message cannot be sent.
pub async fn send( pub async fn send(
user: &mut UserMeta, user: &mut UserMeta,
channel_id: Snowflake, channel_id: Snowflake,
message: &mut MessageSendSchema, message: &mut MessageSendSchema,
files: Option<Vec<PartialDiscordFileAttachment>>, files: Option<Vec<PartialDiscordFileAttachment>>,
) -> Result<Message, crate::errors::ChorusError> { ) -> ChorusResult<Message> {
let url_api = user.belongs_to.borrow().urls.api.clone(); let url_api = user.belongs_to.borrow().urls.api.clone();
if files.is_none() { if files.is_none() {
@ -80,11 +78,8 @@ impl UserMeta {
/// # Arguments /// # Arguments
/// * `url_api` - The URL of the Spacebar server's API. /// * `url_api` - The URL of the Spacebar server's API.
/// * `message` - The [`Message`] that will be sent to the Spacebar server. /// * `message` - The [`Message`] that will be sent to the Spacebar server.
/// * `limits_user` - The [`Limits`] of the user.
/// * `limits_instance` - The [`Limits`] of the instance.
/// * `requester` - The [`LimitedRequester`] that will be used to make requests to the Spacebar server.
/// # Errors /// # Errors
/// * [`ChorusLibError`] - If the message cannot be sent. /// * [`crate::errors::ChorusError`] - If the message cannot be sent.
/// # Notes /// # Notes
/// Shorthand call for Message::send() /// Shorthand call for Message::send()
pub async fn send_message( pub async fn send_message(
@ -92,7 +87,7 @@ impl UserMeta {
message: &mut MessageSendSchema, message: &mut MessageSendSchema,
channel_id: Snowflake, channel_id: Snowflake,
files: Option<Vec<PartialDiscordFileAttachment>>, files: Option<Vec<PartialDiscordFileAttachment>>,
) -> Result<Message, crate::errors::ChorusError> { ) -> ChorusResult<Message> {
Message::send(self, channel_id, message, files).await Message::send(self, channel_id, message, files).await
} }
} }

View File

@ -20,10 +20,10 @@ impl ReactionMeta {
/// # Arguments /// # Arguments
/// * `user` - A mutable reference to a [`UserMeta`] instance. /// * `user` - A mutable reference to a [`UserMeta`] instance.
/// # Returns /// # Returns
/// A `Result` [`()`] [`crate::errors::ChorusLibError`] if something went wrong. /// A `Result` [`()`] [`crate::errors::ChorusError`] if something went wrong.
/// Fires a `Message Reaction Remove All` Gateway event. /// Fires a `Message Reaction Remove All` Gateway event.
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#delete-all-reactions](https://discord.com/developers/docs/resources/channel#delete-all-reactions) /// See <https://discord.com/developers/docs/resources/channel#delete-all-reactions>
pub async fn delete_all(&self, user: &mut UserMeta) -> ChorusResult<()> { pub async fn delete_all(&self, user: &mut UserMeta) -> ChorusResult<()> {
let url = format!( let url = format!(
"{}/channels/{}/messages/{}/reactions/", "{}/channels/{}/messages/{}/reactions/",
@ -47,7 +47,7 @@ impl ReactionMeta {
/// # Returns /// # Returns
/// A Result that is [`Err(crate::errors::ChorusLibError)`] if something went wrong. /// A Result that is [`Err(crate::errors::ChorusLibError)`] if something went wrong.
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#get-reactions](https://discord.com/developers/docs/resources/channel#get-reactions) /// See <https://discord.com/developers/docs/resources/channel#get-reactions>
pub async fn get(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<Vec<PublicUser>> { pub async fn get(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<Vec<PublicUser>> {
let url = format!( let url = format!(
"{}/channels/{}/messages/{}/reactions/{}/", "{}/channels/{}/messages/{}/reactions/{}/",
@ -76,7 +76,7 @@ impl ReactionMeta {
/// A Result that is [`Err(crate::errors::ChorusLibError)`] if something went wrong. /// A Result that is [`Err(crate::errors::ChorusLibError)`] if something went wrong.
/// Fires a `Message Reaction Remove Emoji` Gateway event. /// Fires a `Message Reaction Remove Emoji` Gateway event.
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji](https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji) /// See <https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji>
pub async fn delete_emoji(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> { pub async fn delete_emoji(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> {
let url = format!( let url = format!(
"{}/channels/{}/messages/{}/reactions/{}/", "{}/channels/{}/messages/{}/reactions/{}/",
@ -103,9 +103,9 @@ impl ReactionMeta {
/// format name:id with the emoji name and emoji id. /// format name:id with the emoji name and emoji id.
/// * `user` - A mutable reference to a [`UserMeta`] instance. /// * `user` - A mutable reference to a [`UserMeta`] instance.
/// # Returns /// # Returns
/// A `Result` containing [`()`] or a [`crate::errors::ChorusLibError`]. /// A `Result` containing [`()`] or a [`crate::errors::ChorusError`].
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#create-reaction](https://discord.com/developers/docs/resources/channel#create-reaction) /// See <https://discord.com/developers/docs/resources/channel#create-reaction>
/// ///
pub async fn create(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> { pub async fn create(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> {
let url = format!( let url = format!(
@ -129,10 +129,10 @@ impl ReactionMeta {
/// format name:id with the emoji name and emoji id. /// format name:id with the emoji name and emoji id.
/// * `user` - A mutable reference to a [`UserMeta`] instance. /// * `user` - A mutable reference to a [`UserMeta`] instance.
/// # Returns /// # Returns
/// A `Result` containing [`()`] or a [`crate::errors::ChorusLibError`]. /// A `Result` containing [`()`] or a [`crate::errors::ChorusError`].
/// Fires a `Message Reaction Remove` Gateway event. /// Fires a `Message Reaction Remove` Gateway event.
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#delete-own-reaction](https://discord.com/developers/docs/resources/channel#delete-own-reaction) /// See <https://discord.com/developers/docs/resources/channel#delete-own-reaction>
pub async fn remove(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> { pub async fn remove(&self, emoji: &str, user: &mut UserMeta) -> ChorusResult<()> {
let url = format!( let url = format!(
"{}/channels/{}/messages/{}/reactions/{}/@me/", "{}/channels/{}/messages/{}/reactions/{}/@me/",
@ -157,10 +157,10 @@ impl ReactionMeta {
/// format name:id with the emoji name and emoji id. /// format name:id with the emoji name and emoji id.
/// * `user` - A mutable reference to a [`UserMeta`] instance. /// * `user` - A mutable reference to a [`UserMeta`] instance.
/// # Returns /// # Returns
/// A `Result` containing [`()`] or a [`crate::errors::ChorusLibError`]. /// A [`ChorusResult`] containing [`()`] or a [`crate::errors::ChorusError`].
/// Fires a Message Reaction Remove Gateway event. /// Fires a Message Reaction Remove Gateway event.
/// # Reference /// # Reference
/// See [https://discord.com/developers/docs/resources/channel#delete-own-reaction](https://discord.com/developers/docs/resources/channel#delete-own-reaction) /// See <https://discord.com/developers/docs/resources/channel#delete-user-reaction>
pub async fn delete_user( pub async fn delete_user(
&self, &self,
user_id: Snowflake, user_id: Snowflake,

View File

@ -5,7 +5,7 @@ use crate::{
errors::ChorusResult, errors::ChorusResult,
instance::UserMeta, instance::UserMeta,
ratelimiter::ChorusRequest, ratelimiter::ChorusRequest,
types::{self, Snowflake}, types::{self, GuildMember, Snowflake},
}; };
impl types::GuildMember { impl types::GuildMember {
@ -19,12 +19,12 @@ impl types::GuildMember {
/// ///
/// # Returns /// # Returns
/// ///
/// A [`Result`] containing a [`GuildMember`] if the request succeeds, or a [`ChorusLibError`] if the request fails. /// A [`ChorusResult`] containing a [`GuildMember`] if the request succeeds.
pub async fn get( pub async fn get(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
member_id: Snowflake, member_id: Snowflake,
) -> ChorusResult<types::GuildMember> { ) -> ChorusResult<GuildMember> {
let url = format!( let url = format!(
"{}/guilds/{}/members/{}/", "{}/guilds/{}/members/{}/",
user.belongs_to.borrow().urls.api, user.belongs_to.borrow().urls.api,
@ -36,7 +36,7 @@ impl types::GuildMember {
limit_type: LimitType::Guild(guild_id), limit_type: LimitType::Guild(guild_id),
}; };
chorus_request chorus_request
.deserialize_response::<types::GuildMember>(user) .deserialize_response::<GuildMember>(user)
.await .await
} }
@ -51,7 +51,7 @@ impl types::GuildMember {
/// ///
/// # Returns /// # Returns
/// ///
/// An `Result` containing a `ChorusLibError` if the request fails, or `()` if the request succeeds. /// A [`ChorusResult`] containing a [`crate::errors::ChorusError`] if the request fails, or `()` if the request succeeds.
pub async fn add_role( pub async fn add_role(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
@ -83,7 +83,7 @@ impl types::GuildMember {
/// ///
/// # Returns /// # Returns
/// ///
/// A `Result` containing a `ChorusLibError` if the request fails, or `()` if the request succeeds. /// A [`ChorusResult`] containing a [`crate::errors::ChorusError`] if the request fails, or `()` if the request succeeds.
pub async fn remove_role( pub async fn remove_role(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,

View File

@ -6,7 +6,7 @@ use crate::{
errors::{ChorusError, ChorusResult}, errors::{ChorusError, ChorusResult},
instance::UserMeta, instance::UserMeta,
ratelimiter::ChorusRequest, ratelimiter::ChorusRequest,
types::{self, RoleCreateModifySchema, RoleObject, Snowflake}, types::{self, RoleCreateModifySchema, RoleObject, RolePositionUpdateSchema, Snowflake},
}; };
impl types::RoleObject { impl types::RoleObject {
@ -20,10 +20,6 @@ impl types::RoleObject {
/// # Returns /// # Returns
/// ///
/// An `Option` containing a `Vec` of [`RoleObject`]s if roles were found, or `None` if no roles were found. /// An `Option` containing a `Vec` of [`RoleObject`]s if roles were found, or `None` if no roles were found.
///
/// # Errors
///
/// Returns a [`ChorusLibError`] if the request fails or if the response is invalid.
pub async fn get_all( pub async fn get_all(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
@ -57,11 +53,7 @@ impl types::RoleObject {
/// ///
/// # Returns /// # Returns
/// ///
/// A `Result` containing the retrieved [`RoleObject`] if successful, or a [`ChorusLibError`] if the request fails or if the response is invalid. /// A `Result` containing the retrieved [`RoleObject`] if successful, or a [`ChorusError`] if the request fails or if the response is invalid.
///
/// # Errors
///
/// Returns a [`ChorusLibError`] if the request fails or if the response is invalid.
pub async fn get( pub async fn get(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
@ -92,11 +84,7 @@ impl types::RoleObject {
/// ///
/// # Returns /// # Returns
/// ///
/// A `Result` containing the newly created [`RoleObject`] if successful, or a [`ChorusLibError`] if the request fails or if the response is invalid. /// A `Result` containing the newly created [`RoleObject`] if successful, or a [`ChorusError`] if the request fails or if the response is invalid.
///
/// # Errors
///
/// Returns a [`ChorusLibError`] if the request fails or if the response is invalid.
pub async fn create( pub async fn create(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
@ -131,15 +119,11 @@ impl types::RoleObject {
/// ///
/// # Returns /// # Returns
/// ///
/// A `Result` containing the updated [`RoleObject`] if successful, or a [`ChorusLibError`] if the request fails or if the response is invalid. /// A `Result` containing the updated [`RoleObject`] if successful, or a [`ChorusError`] if the request fails or if the response is invalid.
///
/// # Errors
///
/// Returns a [`ChorusLibError`] if the request fails or if the response is invalid.
pub async fn position_update( pub async fn position_update(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,
role_position_update_schema: types::RolePositionUpdateSchema, role_position_update_schema: RolePositionUpdateSchema,
) -> ChorusResult<RoleObject> { ) -> ChorusResult<RoleObject> {
let url = format!( let url = format!(
"{}/guilds/{}/roles/", "{}/guilds/{}/roles/",
@ -173,11 +157,7 @@ impl types::RoleObject {
/// ///
/// # Returns /// # Returns
/// ///
/// A `Result` containing the updated [`RoleObject`] if successful, or a [`ChorusLibError`] if the request fails or if the response is invalid. /// A `Result` containing the updated [`RoleObject`] if successful, or a [`ChorusError`] if the request fails or if the response is invalid.
///
/// # Errors
///
/// Returns a [`ChorusLibError`] if the request fails or if the response is invalid.
pub async fn update( pub async fn update(
user: &mut UserMeta, user: &mut UserMeta,
guild_id: Snowflake, guild_id: Snowflake,

View File

@ -7,7 +7,7 @@ use crate::types::GeneralConfiguration;
impl Instance { impl Instance {
/// Gets the instance policies schema. /// Gets the instance policies schema.
/// # Errors /// # Errors
/// [`ChorusLibError`] - If the request fails. /// [`ChorusError`] - If the request fails.
pub async fn general_configuration_schema(&self) -> ChorusResult<GeneralConfiguration> { pub async fn general_configuration_schema(&self) -> ChorusResult<GeneralConfiguration> {
let endpoint_url = self.urls.api.clone() + "/policies/instance/"; let endpoint_url = self.urls.api.clone() + "/policies/instance/";
let request = match self.client.get(&endpoint_url).send().await { let request = match self.client.get(&endpoint_url).send().await {

View File

@ -22,8 +22,6 @@ pub enum LimitType {
} }
/// A struct that represents the current ratelimits, either instance-wide or user-wide. /// A struct that represents the current ratelimits, either instance-wide or user-wide.
/// Unlike [`RateLimits`], this struct shows the current ratelimits, not the rate limit
/// configuration for the instance.
/// See <https://discord.com/developers/docs/topics/rate-limits#rate-limits> for more information. /// See <https://discord.com/developers/docs/topics/rate-limits#rate-limits> for more information.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Limit { pub struct Limit {

View File

@ -6,7 +6,9 @@ use crate::{
errors::ChorusResult, errors::ChorusResult,
instance::UserMeta, instance::UserMeta,
ratelimiter::ChorusRequest, ratelimiter::ChorusRequest,
types::{self, CreateUserRelationshipSchema, RelationshipType, Snowflake}, types::{
self, CreateUserRelationshipSchema, FriendRequestSendSchema, RelationshipType, Snowflake,
},
}; };
impl UserMeta { impl UserMeta {
@ -61,10 +63,10 @@ impl UserMeta {
/// * `schema` - A [`FriendRequestSendSchema`] struct that holds the information about the friend request to be sent. /// * `schema` - A [`FriendRequestSendSchema`] struct that holds the information about the friend request to be sent.
/// ///
/// # Returns /// # Returns
/// This function returns a [`Result`] that holds a [`ChorusLibError`] if the request fails. /// This function returns a [`ChorusResult`].
pub async fn send_friend_request( pub async fn send_friend_request(
&mut self, &mut self,
schema: types::FriendRequestSendSchema, schema: FriendRequestSendSchema,
) -> ChorusResult<()> { ) -> ChorusResult<()> {
let url = format!( let url = format!(
"{}/users/@me/relationships/", "{}/users/@me/relationships/",
@ -91,7 +93,7 @@ impl UserMeta {
/// * [`RelationshipType::Blocked`]: Blocks the specified user_id. /// * [`RelationshipType::Blocked`]: Blocks the specified user_id.
/// ///
/// # Returns /// # Returns
/// This function returns an [`Result`] that holds a [`ChorusLibError`] if the request fails. /// This function returns an [`ChorusResult`].
pub async fn modify_user_relationship( pub async fn modify_user_relationship(
&mut self, &mut self,
user_id: Snowflake, user_id: Snowflake,
@ -149,7 +151,7 @@ impl UserMeta {
/// * `user_id` - ID of the user to remove the relationship with. /// * `user_id` - ID of the user to remove the relationship with.
/// ///
/// # Returns /// # Returns
/// This function returns a [`Result`] that holds a [`ChorusLibError`] if the request fails. /// This function returns a [`ChorusResult`].
pub async fn remove_relationship(&mut self, user_id: Snowflake) -> ChorusResult<()> { pub async fn remove_relationship(&mut self, user_id: Snowflake) -> ChorusResult<()> {
let url = format!( let url = format!(
"{}/users/@me/relationships/{}/", "{}/users/@me/relationships/{}/",

View File

@ -19,11 +19,10 @@ impl UserMeta {
/// * `token` - A valid access token for the API. /// * `token` - A valid access token for the API.
/// * `url_api` - The URL to the API. /// * `url_api` - The URL to the API.
/// * `id` - The id of the user that will be retrieved. If this is None, the current user will be retrieved. /// * `id` - The id of the user that will be retrieved. If this is None, the current user will be retrieved.
/// * `instance_limits` - The [`Limits`] of the instance.
/// ///
/// # Errors /// # Errors
/// ///
/// * [`ChorusLibError`] - If the request fails. /// * [`ChorusError`] - If the request fails.
pub async fn get(user: &mut UserMeta, id: Option<&String>) -> ChorusResult<User> { pub async fn get(user: &mut UserMeta, id: Option<&String>) -> ChorusResult<User> {
User::get(user, id).await User::get(user, id).await
} }
@ -44,7 +43,7 @@ impl UserMeta {
/// ///
/// # Errors /// # Errors
/// ///
/// Returns an `ChorusLibError` if the request fails or if a password is required but not provided. /// Returns an [`ChorusError`] if the request fails or if a password is required but not provided.
pub async fn modify(&mut self, modify_schema: UserModifySchema) -> ChorusResult<User> { pub async fn modify(&mut self, modify_schema: UserModifySchema) -> ChorusResult<User> {
if modify_schema.new_password.is_some() if modify_schema.new_password.is_some()
|| modify_schema.email.is_some() || modify_schema.email.is_some()
@ -76,7 +75,7 @@ impl UserMeta {
/// ///
/// # Returns /// # Returns
/// ///
/// Returns `()` if the user was successfully deleted, or a `ChorusLibError` if an error occurred. /// Returns `()` if the user was successfully deleted, or a [`ChorusError`] if an error occurred.
pub async fn delete(mut self) -> ChorusResult<()> { pub async fn delete(mut self) -> ChorusResult<()> {
let request = Client::new() let request = Client::new()
.post(format!( .post(format!(
@ -145,7 +144,7 @@ impl Instance {
// * `token` - A valid access token for the API. // * `token` - A valid access token for the API.
// * `id` - The id of the user that will be retrieved. If this is None, the current user will be retrieved. // * `id` - The id of the user that will be retrieved. If this is None, the current user will be retrieved.
// # Errors // # Errors
// * [`ChorusLibError`] - If the request fails. // * [`ChorusError`] - If the request fails.
// # Notes // # Notes
// This function is a wrapper around [`User::get`]. // This function is a wrapper around [`User::get`].
pub async fn get_user(&mut self, token: String, id: Option<&String>) -> ChorusResult<User> { pub async fn get_user(&mut self, token: String, id: Option<&String>) -> ChorusResult<User> {

View File

@ -72,7 +72,7 @@ const GATEWAY_LAZY_REQUEST: u8 = 14;
/// The amount of time we wait for a heartbeat ack before resending our heartbeat in ms /// The amount of time we wait for a heartbeat ack before resending our heartbeat in ms
const HEARTBEAT_ACK_TIMEOUT: u128 = 2000; const HEARTBEAT_ACK_TIMEOUT: u128 = 2000;
/// Represents a messsage received from the gateway. This will be either a [GatewayReceivePayload], containing events, or a [GatewayError]. /// Represents a messsage received from the gateway. This will be either a [types::GatewayReceivePayload], containing events, or a [GatewayError].
/// This struct is used internally when handling messages. /// This struct is used internally when handling messages.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct GatewayMessage { pub struct GatewayMessage {
@ -144,7 +144,7 @@ impl GatewayMessage {
/// Represents a handle to a Gateway connection. A Gateway connection will create observable /// Represents a handle to a Gateway connection. A Gateway connection will create observable
/// [`GatewayEvents`](GatewayEvent), which you can subscribe to. Gateway events include all currently /// [`GatewayEvents`](GatewayEvent), which you can subscribe to. Gateway events include all currently
/// implemented [Types] with the trait [`WebSocketEvent`] /// implemented types with the trait [`WebSocketEvent`]
/// Using this handle you can also send Gateway Events directly. /// Using this handle you can also send Gateway Events directly.
#[derive(Debug)] #[derive(Debug)]
pub struct GatewayHandle { pub struct GatewayHandle {

View File

@ -30,12 +30,7 @@ pub struct LimitsInformation {
} }
impl Instance { impl Instance {
/// Creates a new [`Instance`]. /// Creates a new [`Instance`] from the [relevant instance urls](UrlBundle), where `limited` is whether or not to automatically use rate limits.
/// # Arguments
/// * `urls` - The [`URLBundle`] that contains all the URLs that are needed to connect to the Spacebar server.
/// * `requester` - The [`LimitedRequester`] that will be used to make requests to the Spacebar server.
/// # Errors
/// * [`InstanceError`] - If the instance cannot be created.
pub async fn new(urls: UrlBundle, limited: bool) -> ChorusResult<Instance> { pub async fn new(urls: UrlBundle, limited: bool) -> ChorusResult<Instance> {
let limits_information; let limits_information;
if limited { if limited {

View File

@ -168,7 +168,7 @@ pub struct ApplicationCommandInteractionDataOption {
} }
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
/// See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure /// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure>
pub struct GuildApplicationCommandPermissions { pub struct GuildApplicationCommandPermissions {
pub id: Snowflake, pub id: Snowflake,
pub application_id: Snowflake, pub application_id: Snowflake,
@ -177,7 +177,7 @@ pub struct GuildApplicationCommandPermissions {
} }
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
/// See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure /// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure>
pub struct ApplicationCommandPermission { pub struct ApplicationCommandPermission {
pub id: Snowflake, pub id: Snowflake,
#[serde(rename = "type")] #[serde(rename = "type")]
@ -189,7 +189,7 @@ pub struct ApplicationCommandPermission {
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq)] #[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[repr(u8)] #[repr(u8)]
/// See https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type /// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type>
pub enum ApplicationCommandPermissionType { pub enum ApplicationCommandPermissionType {
#[default] #[default]
Role = 1, Role = 1,

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::utils::Snowflake; use crate::types::utils::Snowflake;
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object /// See <https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object>
pub struct AuditLogEntry { pub struct AuditLogEntry {
pub target_id: Option<String>, pub target_id: Option<String>,
pub changes: Option<Vec<AuditLogChange>>, pub changes: Option<Vec<AuditLogChange>>,
@ -17,7 +17,7 @@ pub struct AuditLogEntry {
} }
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/audit-log#audit-log-change-object /// See <https://discord.com/developers/docs/resources/audit-log#audit-log-change-object>
pub struct AuditLogChange { pub struct AuditLogChange {
pub new_value: Option<serde_json::Value>, pub new_value: Option<serde_json::Value>,
pub old_value: Option<serde_json::Value>, pub old_value: Option<serde_json::Value>,

View File

@ -4,7 +4,7 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::types::utils::Snowflake; use crate::types::utils::Snowflake;
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object>
pub struct AutoModerationRule { pub struct AutoModerationRule {
pub id: Snowflake, pub id: Snowflake,
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -22,7 +22,7 @@ pub struct AutoModerationRule {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)]
#[repr(u8)] #[repr(u8)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types>
pub enum AutoModerationRuleEventType { pub enum AutoModerationRuleEventType {
#[default] #[default]
MessageSend = 1, MessageSend = 1,
@ -31,7 +31,7 @@ pub enum AutoModerationRuleEventType {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)]
#[repr(u8)] #[repr(u8)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types>
pub enum AutoModerationRuleTriggerType { pub enum AutoModerationRuleTriggerType {
#[default] #[default]
Keyword = 1, Keyword = 1,
@ -42,7 +42,7 @@ pub enum AutoModerationRuleTriggerType {
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
#[serde(untagged)] #[serde(untagged)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
pub enum AutoModerationRuleTriggerMetadata { pub enum AutoModerationRuleTriggerMetadata {
ForKeyword(AutoModerationRuleTriggerMetadataForKeyword), ForKeyword(AutoModerationRuleTriggerMetadataForKeyword),
ForKeywordPreset(AutoModerationRuleTriggerMetadataForKeywordPreset), ForKeywordPreset(AutoModerationRuleTriggerMetadataForKeywordPreset),
@ -52,7 +52,7 @@ pub enum AutoModerationRuleTriggerMetadata {
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
pub struct AutoModerationRuleTriggerMetadataForKeyword { pub struct AutoModerationRuleTriggerMetadataForKeyword {
pub keyword_filter: Vec<String>, pub keyword_filter: Vec<String>,
pub regex_patterns: Vec<String>, pub regex_patterns: Vec<String>,
@ -60,14 +60,14 @@ pub struct AutoModerationRuleTriggerMetadataForKeyword {
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
pub struct AutoModerationRuleTriggerMetadataForKeywordPreset { pub struct AutoModerationRuleTriggerMetadataForKeywordPreset {
pub presets: Vec<AutoModerationRuleKeywordPresetType>, pub presets: Vec<AutoModerationRuleKeywordPresetType>,
pub allow_list: Vec<String>, pub allow_list: Vec<String>,
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
pub struct AutoModerationRuleTriggerMetadataForMentionSpam { pub struct AutoModerationRuleTriggerMetadataForMentionSpam {
/// Max 50 /// Max 50
pub mention_total_limit: u8, pub mention_total_limit: u8,
@ -77,7 +77,7 @@ pub struct AutoModerationRuleTriggerMetadataForMentionSpam {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)]
#[repr(u8)] #[repr(u8)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types>
pub enum AutoModerationRuleKeywordPresetType { pub enum AutoModerationRuleKeywordPresetType {
#[default] #[default]
Profanity = 1, Profanity = 1,
@ -86,7 +86,7 @@ pub enum AutoModerationRuleKeywordPresetType {
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object>
pub struct AutoModerationAction { pub struct AutoModerationAction {
#[serde(rename = "type")] #[serde(rename = "type")]
pub action_type: AutoModerationActionType, pub action_type: AutoModerationActionType,
@ -96,7 +96,7 @@ pub struct AutoModerationAction {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)]
#[repr(u8)] #[repr(u8)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types>
pub enum AutoModerationActionType { pub enum AutoModerationActionType {
#[default] #[default]
BlockMessage = 1, BlockMessage = 1,
@ -106,7 +106,7 @@ pub enum AutoModerationActionType {
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
#[serde(untagged)] #[serde(untagged)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata>
pub enum AutoModerationActionMetadata { pub enum AutoModerationActionMetadata {
ForBlockMessage(AutoModerationActionMetadataForBlockMessage), ForBlockMessage(AutoModerationActionMetadataForBlockMessage),
ForSendAlertMessage(AutoModerationActionMetadataForSendAlertMessage), ForSendAlertMessage(AutoModerationActionMetadataForSendAlertMessage),
@ -116,19 +116,19 @@ pub enum AutoModerationActionMetadata {
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata>
pub struct AutoModerationActionMetadataForBlockMessage { pub struct AutoModerationActionMetadataForBlockMessage {
pub custom_message: Option<String>, pub custom_message: Option<String>,
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata>
pub struct AutoModerationActionMetadataForSendAlertMessage { pub struct AutoModerationActionMetadataForSendAlertMessage {
pub channel_id: Snowflake, pub channel_id: Snowflake,
} }
#[derive(Serialize, Deserialize, Debug, Clone, Default)] #[derive(Serialize, Deserialize, Debug, Clone, Default)]
/// See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata /// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata>
pub struct AutoModerationActionMetadataForTimeout { pub struct AutoModerationActionMetadataForTimeout {
/// Max 2419200 /// Max 2419200
pub duration_seconds: u32, pub duration_seconds: u32,

View File

@ -9,7 +9,7 @@ use crate::types::{
utils::Snowflake, utils::Snowflake,
}; };
/// See https://discord.com/developers/docs/resources/guild /// See <https://discord.com/developers/docs/resources/guild>
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct Guild { pub struct Guild {
@ -90,7 +90,7 @@ pub struct Guild {
pub widget_enabled: Option<bool>, pub widget_enabled: Option<bool>,
} }
/// See https://docs.spacebar.chat/routes/#get-/guilds/-guild_id-/bans/-user- /// See <https://docs.spacebar.chat/routes/#get-/guilds/-guild_id-/bans/-user->
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct GuildBan { pub struct GuildBan {
@ -99,7 +99,7 @@ pub struct GuildBan {
pub reason: Option<String>, pub reason: Option<String>,
} }
/// See https://docs.spacebar.chat/routes/#cmp--schemas-invite /// See <https://docs.spacebar.chat/routes/#cmp--schemas-invite>
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct GuildInvite { pub struct GuildInvite {
@ -134,7 +134,7 @@ pub struct GuildCreateResponse {
} }
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object /// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object>
pub struct GuildScheduledEvent { pub struct GuildScheduledEvent {
pub id: Snowflake, pub id: Snowflake,
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -156,7 +156,7 @@ pub struct GuildScheduledEvent {
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)] #[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)]
#[repr(u8)] #[repr(u8)]
/// See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level /// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level>
pub enum GuildScheduledEventPrivacyLevel { pub enum GuildScheduledEventPrivacyLevel {
#[default] #[default]
GuildOnly = 2, GuildOnly = 2,
@ -164,7 +164,7 @@ pub enum GuildScheduledEventPrivacyLevel {
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)] #[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)]
#[repr(u8)] #[repr(u8)]
/// See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status /// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status>
pub enum GuildScheduledEventStatus { pub enum GuildScheduledEventStatus {
#[default] #[default]
Scheduled = 1, Scheduled = 1,
@ -175,7 +175,7 @@ pub enum GuildScheduledEventStatus {
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)] #[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)]
#[repr(u8)] #[repr(u8)]
/// See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types /// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types>
pub enum GuildScheduledEventEntityType { pub enum GuildScheduledEventEntityType {
#[default] #[default]
StageInstance = 1, StageInstance = 1,
@ -184,7 +184,7 @@ pub enum GuildScheduledEventEntityType {
} }
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata /// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata>
pub struct GuildScheduledEventEntityMetadata { pub struct GuildScheduledEventEntityMetadata {
pub location: Option<String>, pub location: Option<String>,
} }

View File

@ -8,7 +8,7 @@ use crate::types::{
#[derive(Default, Debug, Deserialize, Serialize, Clone)] #[derive(Default, Debug, Deserialize, Serialize, Clone)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
/// See https://discord.com/developers/docs/resources/guild#integration-object-integration-structure /// See <https://discord.com/developers/docs/resources/guild#integration-object-integration-structure>
pub struct Integration { pub struct Integration {
pub id: Snowflake, pub id: Snowflake,
pub name: String, pub name: String,
@ -33,7 +33,7 @@ pub struct Integration {
} }
#[derive(Default, Debug, Deserialize, Serialize, Clone)] #[derive(Default, Debug, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure /// See <https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure>
pub struct IntegrationAccount { pub struct IntegrationAccount {
pub id: String, pub id: String,
pub name: String, pub name: String,

View File

@ -7,7 +7,7 @@ use crate::types::Snowflake;
use super::PublicUser; use super::PublicUser;
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq, Eq)]
/// See https://discord-userdoccers.vercel.app/resources/user#relationship-structure /// See <https://discord-userdoccers.vercel.app/resources/user#relationship-structure>
pub struct Relationship { pub struct Relationship {
pub id: Snowflake, pub id: Snowflake,
#[serde(rename = "type")] #[serde(rename = "type")]
@ -19,7 +19,7 @@ pub struct Relationship {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Eq, PartialEq)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Eq, PartialEq)]
#[repr(u8)] #[repr(u8)]
/// See https://discord-userdoccers.vercel.app/resources/user#relationship-type /// See <https://discord-userdoccers.vercel.app/resources/user#relationship-type>
pub enum RelationshipType { pub enum RelationshipType {
Suggestion = 6, Suggestion = 6,
Implicit = 5, Implicit = 5,

View File

@ -6,7 +6,7 @@ use crate::types::utils::Snowflake;
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
/// See https://discord.com/developers/docs/topics/permissions#role-object /// See <https://discord.com/developers/docs/topics/permissions#role-object>
pub struct RoleObject { pub struct RoleObject {
pub id: Snowflake, pub id: Snowflake,
pub name: String, pub name: String,
@ -35,7 +35,7 @@ pub struct RoleSubscriptionData {
} }
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
/// See https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure /// See <https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure>
pub struct RoleTags { pub struct RoleTags {
#[serde(default)] #[serde(default)]
#[serde(deserialize_with = "deserialize_option_number_from_string")] #[serde(deserialize_with = "deserialize_option_number_from_string")]

View File

@ -4,12 +4,12 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::types::Snowflake; use crate::types::Snowflake;
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]
/// See https://discord.com/developers/docs/resources/stage-instance /// See <https://discord.com/developers/docs/resources/stage-instance>
pub struct StageInstance { pub struct StageInstance {
pub id: Snowflake, pub id: Snowflake,
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub channel_id: Snowflake, pub channel_id: Snowflake,
/// 1 - 120 chars /// 1 - 120 characters
pub topic: String, pub topic: String,
pub privacy_level: StageInstancePrivacyLevel, pub privacy_level: StageInstancePrivacyLevel,
/// deprecated, apparently /// deprecated, apparently
@ -20,7 +20,7 @@ pub struct StageInstance {
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)] #[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default)]
#[repr(u8)] #[repr(u8)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
/// See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level /// See <https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level>
pub enum StageInstancePrivacyLevel { pub enum StageInstancePrivacyLevel {
/// deprecated, apparently /// deprecated, apparently
Public = 1, Public = 1,

View File

@ -6,7 +6,7 @@ use crate::types::{
utils::Snowflake, utils::Snowflake,
}; };
/// See https://docs.spacebar.chat/routes/#cmp--schemas-template /// See <https://docs.spacebar.chat/routes/#cmp--schemas-template>
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct GuildTemplate { pub struct GuildTemplate {

View File

@ -6,7 +6,7 @@ use crate::types::{
utils::Snowflake, utils::Snowflake,
}; };
/// See https://docs.spacebar.chat/routes/#cmp--schemas-voicestate /// See <https://docs.spacebar.chat/routes/#cmp--schemas-voicestate>
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct VoiceState { pub struct VoiceState {

View File

@ -5,7 +5,7 @@ use crate::types::{
utils::Snowflake, utils::Snowflake,
}; };
/// See https://docs.spacebar.chat/routes/#cmp--schemas-webhook /// See <https://docs.spacebar.chat/routes/#cmp--schemas-webhook>
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))] #[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct Webhook { pub struct Webhook {

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{GuildApplicationCommandPermissions, WebSocketEvent}; use crate::types::{GuildApplicationCommandPermissions, WebSocketEvent};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update /// See <https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update>
pub struct ApplicationCommandPermissionsUpdate { pub struct ApplicationCommandPermissionsUpdate {
#[serde(flatten)] #[serde(flatten)]
pub permissions: GuildApplicationCommandPermissions, pub permissions: GuildApplicationCommandPermissions,

View File

@ -6,7 +6,7 @@ use crate::types::{
}; };
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-create /// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-create>
pub struct AutoModerationRuleCreate { pub struct AutoModerationRuleCreate {
#[serde(flatten)] #[serde(flatten)]
pub rule: AutoModerationRule, pub rule: AutoModerationRule,
@ -15,7 +15,7 @@ pub struct AutoModerationRuleCreate {
impl WebSocketEvent for AutoModerationRuleCreate {} impl WebSocketEvent for AutoModerationRuleCreate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-update /// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-update>
pub struct AutoModerationRuleUpdate { pub struct AutoModerationRuleUpdate {
#[serde(flatten)] #[serde(flatten)]
pub rule: AutoModerationRule, pub rule: AutoModerationRule,
@ -24,7 +24,7 @@ pub struct AutoModerationRuleUpdate {
impl WebSocketEvent for AutoModerationRuleUpdate {} impl WebSocketEvent for AutoModerationRuleUpdate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-delete /// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-delete>
pub struct AutoModerationRuleDelete { pub struct AutoModerationRuleDelete {
#[serde(flatten)] #[serde(flatten)]
pub rule: AutoModerationRule, pub rule: AutoModerationRule,
@ -33,7 +33,7 @@ pub struct AutoModerationRuleDelete {
impl WebSocketEvent for AutoModerationRuleDelete {} impl WebSocketEvent for AutoModerationRuleDelete {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution /// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution>
pub struct AutoModerationActionExecution { pub struct AutoModerationActionExecution {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub action: AutoModerationAction, pub action: AutoModerationAction,

View File

@ -50,7 +50,7 @@ impl WebSocketEvent for CallDelete {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// Officially Undocumented; /// Officially Undocumented;
/// See https://unofficial-discord-docs.vercel.app/gateway/op13; /// See <https://unofficial-discord-docs.vercel.app/gateway/op13>;
/// ///
/// Ex: {"op":13,"d":{"channel_id":"837609115475771392"}} /// Ex: {"op":13,"d":{"channel_id":"837609115475771392"}}
pub struct CallSync { pub struct CallSync {

View File

@ -4,7 +4,7 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Deserialize, Serialize)] #[derive(Debug, Default, Deserialize, Serialize)]
/// See https://discord.com/developers/docs/topics/gateway-events#channel-pins-update /// See <https://discord.com/developers/docs/topics/gateway-events#channel-pins-update>
pub struct ChannelPinsUpdate { pub struct ChannelPinsUpdate {
pub guild_id: Option<Snowflake>, pub guild_id: Option<Snowflake>,
pub channel_id: Snowflake, pub channel_id: Snowflake,
@ -14,7 +14,7 @@ pub struct ChannelPinsUpdate {
impl WebSocketEvent for ChannelPinsUpdate {} impl WebSocketEvent for ChannelPinsUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#channel-create /// See <https://discord.com/developers/docs/topics/gateway-events#channel-create>
pub struct ChannelCreate { pub struct ChannelCreate {
#[serde(flatten)] #[serde(flatten)]
pub channel: Channel, pub channel: Channel,
@ -23,7 +23,7 @@ pub struct ChannelCreate {
impl WebSocketEvent for ChannelCreate {} impl WebSocketEvent for ChannelCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#channel-update /// See <https://discord.com/developers/docs/topics/gateway-events#channel-update>
pub struct ChannelUpdate { pub struct ChannelUpdate {
#[serde(flatten)] #[serde(flatten)]
pub channel: Channel, pub channel: Channel,
@ -42,7 +42,7 @@ pub struct ChannelUnreadUpdate {
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// Contains very few fields from [Channel] /// Contains very few fields from [Channel]
/// See also [ChannelUnreadUpdates] /// See also [ChannelUnreadUpdate]
pub struct ChannelUnreadUpdateObject { pub struct ChannelUnreadUpdateObject {
pub id: Snowflake, pub id: Snowflake,
pub last_message_id: Snowflake, pub last_message_id: Snowflake,
@ -52,7 +52,7 @@ pub struct ChannelUnreadUpdateObject {
impl WebSocketEvent for ChannelUnreadUpdate {} impl WebSocketEvent for ChannelUnreadUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#channel-delete /// See <https://discord.com/developers/docs/topics/gateway-events#channel-delete>
pub struct ChannelDelete { pub struct ChannelDelete {
#[serde(flatten)] #[serde(flatten)]
pub channel: Channel, pub channel: Channel,

View File

@ -10,7 +10,7 @@ use crate::types::{
use super::PresenceUpdate; use super::PresenceUpdate;
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-create; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-create>;
/// Received to give data about a guild; /// Received to give data about a guild;
// This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object // This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object
pub struct GuildCreate { pub struct GuildCreate {
@ -34,7 +34,7 @@ impl Default for GuildCreateDataOption {
impl WebSocketEvent for GuildCreate {} impl WebSocketEvent for GuildCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-add-guild-ban-add-event-fields; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-ban-add-guild-ban-add-event-fields>;
/// Received to give info about a user being banned from a guild; /// Received to give info about a user being banned from a guild;
pub struct GuildBanAdd { pub struct GuildBanAdd {
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -44,7 +44,7 @@ pub struct GuildBanAdd {
impl WebSocketEvent for GuildBanAdd {} impl WebSocketEvent for GuildBanAdd {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-remove; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-ban-remove>;
/// Received to give info about a user being unbanned from a guild; /// Received to give info about a user being unbanned from a guild;
pub struct GuildBanRemove { pub struct GuildBanRemove {
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -54,7 +54,7 @@ pub struct GuildBanRemove {
impl WebSocketEvent for GuildBanRemove {} impl WebSocketEvent for GuildBanRemove {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-update; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-update>;
/// Received to give info about a guild being updated; /// Received to give info about a guild being updated;
pub struct GuildUpdate { pub struct GuildUpdate {
#[serde(flatten)] #[serde(flatten)]
@ -64,7 +64,7 @@ pub struct GuildUpdate {
impl WebSocketEvent for GuildUpdate {} impl WebSocketEvent for GuildUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-delete; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-delete>;
/// Received to tell the client about a guild being deleted; /// Received to tell the client about a guild being deleted;
pub struct GuildDelete { pub struct GuildDelete {
#[serde(flatten)] #[serde(flatten)]
@ -74,7 +74,7 @@ pub struct GuildDelete {
impl WebSocketEvent for GuildDelete {} impl WebSocketEvent for GuildDelete {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create>;
/// Received to the client about an audit log entry being added; /// Received to the client about an audit log entry being added;
pub struct GuildAuditLogEntryCreate { pub struct GuildAuditLogEntryCreate {
#[serde(flatten)] #[serde(flatten)]
@ -84,7 +84,7 @@ pub struct GuildAuditLogEntryCreate {
impl WebSocketEvent for GuildAuditLogEntryCreate {} impl WebSocketEvent for GuildAuditLogEntryCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update>;
/// Received to tell the client about a change to a guild's emoji list; /// Received to tell the client about a change to a guild's emoji list;
pub struct GuildEmojisUpdate { pub struct GuildEmojisUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -94,7 +94,7 @@ pub struct GuildEmojisUpdate {
impl WebSocketEvent for GuildEmojisUpdate {} impl WebSocketEvent for GuildEmojisUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update>;
/// Received to tell the client about a change to a guild's sticker list; /// Received to tell the client about a change to a guild's sticker list;
pub struct GuildStickersUpdate { pub struct GuildStickersUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -104,7 +104,7 @@ pub struct GuildStickersUpdate {
impl WebSocketEvent for GuildStickersUpdate {} impl WebSocketEvent for GuildStickersUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-integrations-update /// See <https://discord.com/developers/docs/topics/gateway-events#guild-integrations-update>
pub struct GuildIntegrationsUpdate { pub struct GuildIntegrationsUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
} }
@ -112,7 +112,7 @@ pub struct GuildIntegrationsUpdate {
impl WebSocketEvent for GuildIntegrationsUpdate {} impl WebSocketEvent for GuildIntegrationsUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-add; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-member-add>;
/// Received to tell the client about a user joining a guild; /// Received to tell the client about a user joining a guild;
pub struct GuildMemberAdd { pub struct GuildMemberAdd {
#[serde(flatten)] #[serde(flatten)]
@ -123,7 +123,7 @@ pub struct GuildMemberAdd {
impl WebSocketEvent for GuildMemberAdd {} impl WebSocketEvent for GuildMemberAdd {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-remove; /// See <https://discord.com/developers/docs/topics/gateway-events#guild-member-remove>;
/// Received to tell the client about a user leaving a guild; /// Received to tell the client about a user leaving a guild;
pub struct GuildMemberRemove { pub struct GuildMemberRemove {
pub guild_id: Snowflake, pub guild_id: Snowflake,
@ -133,7 +133,7 @@ pub struct GuildMemberRemove {
impl WebSocketEvent for GuildMemberRemove {} impl WebSocketEvent for GuildMemberRemove {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-update /// See <https://discord.com/developers/docs/topics/gateway-events#guild-member-update>
pub struct GuildMemberUpdate { pub struct GuildMemberUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub roles: Vec<Snowflake>, pub roles: Vec<Snowflake>,
@ -151,7 +151,7 @@ pub struct GuildMemberUpdate {
impl WebSocketEvent for GuildMemberUpdate {} impl WebSocketEvent for GuildMemberUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-members-chunk /// See <https://discord.com/developers/docs/topics/gateway-events#guild-members-chunk>
pub struct GuildMembersChunk { pub struct GuildMembersChunk {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub members: Vec<GuildMember>, pub members: Vec<GuildMember>,
@ -165,7 +165,7 @@ pub struct GuildMembersChunk {
impl WebSocketEvent for GuildMembersChunk {} impl WebSocketEvent for GuildMembersChunk {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-role-create /// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-create>
pub struct GuildRoleCreate { pub struct GuildRoleCreate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub role: RoleObject, pub role: RoleObject,
@ -174,7 +174,7 @@ pub struct GuildRoleCreate {
impl WebSocketEvent for GuildRoleCreate {} impl WebSocketEvent for GuildRoleCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-role-update /// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-update>
pub struct GuildRoleUpdate { pub struct GuildRoleUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub role: RoleObject, pub role: RoleObject,
@ -183,7 +183,7 @@ pub struct GuildRoleUpdate {
impl WebSocketEvent for GuildRoleUpdate {} impl WebSocketEvent for GuildRoleUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-role-delete /// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-delete>
pub struct GuildRoleDelete { pub struct GuildRoleDelete {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub role_id: Snowflake, pub role_id: Snowflake,
@ -192,7 +192,7 @@ pub struct GuildRoleDelete {
impl WebSocketEvent for GuildRoleDelete {} impl WebSocketEvent for GuildRoleDelete {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-create /// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-create>
pub struct GuildScheduledEventCreate { pub struct GuildScheduledEventCreate {
#[serde(flatten)] #[serde(flatten)]
pub event: GuildScheduledEvent, pub event: GuildScheduledEvent,
@ -201,7 +201,7 @@ pub struct GuildScheduledEventCreate {
impl WebSocketEvent for GuildScheduledEventCreate {} impl WebSocketEvent for GuildScheduledEventCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-update /// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-update>
pub struct GuildScheduledEventUpdate { pub struct GuildScheduledEventUpdate {
#[serde(flatten)] #[serde(flatten)]
pub event: GuildScheduledEvent, pub event: GuildScheduledEvent,
@ -210,7 +210,7 @@ pub struct GuildScheduledEventUpdate {
impl WebSocketEvent for GuildScheduledEventUpdate {} impl WebSocketEvent for GuildScheduledEventUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-delete /// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-delete>
pub struct GuildScheduledEventDelete { pub struct GuildScheduledEventDelete {
#[serde(flatten)] #[serde(flatten)]
pub event: GuildScheduledEvent, pub event: GuildScheduledEvent,
@ -219,7 +219,7 @@ pub struct GuildScheduledEventDelete {
impl WebSocketEvent for GuildScheduledEventDelete {} impl WebSocketEvent for GuildScheduledEventDelete {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add /// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add>
pub struct GuildScheduledEventUserAdd { pub struct GuildScheduledEventUserAdd {
pub guild_scheduled_event_id: Snowflake, pub guild_scheduled_event_id: Snowflake,
pub user_id: Snowflake, pub user_id: Snowflake,
@ -229,7 +229,7 @@ pub struct GuildScheduledEventUserAdd {
impl WebSocketEvent for GuildScheduledEventUserAdd {} impl WebSocketEvent for GuildScheduledEventUserAdd {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-remove /// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-remove>
pub struct GuildScheduledEventUserRemove { pub struct GuildScheduledEventUserRemove {
pub guild_scheduled_event_id: Snowflake, pub guild_scheduled_event_id: Snowflake,
pub user_id: Snowflake, pub user_id: Snowflake,

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{Integration, Snowflake, WebSocketEvent}; use crate::types::{Integration, Snowflake, WebSocketEvent};
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#integration-create /// See <https://discord.com/developers/docs/topics/gateway-events#integration-create>
pub struct IntegrationCreate { pub struct IntegrationCreate {
#[serde(flatten)] #[serde(flatten)]
pub integration: Integration, pub integration: Integration,
@ -13,7 +13,7 @@ pub struct IntegrationCreate {
impl WebSocketEvent for IntegrationCreate {} impl WebSocketEvent for IntegrationCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#integration-update /// See <https://discord.com/developers/docs/topics/gateway-events#integration-update>
pub struct IntegrationUpdate { pub struct IntegrationUpdate {
#[serde(flatten)] #[serde(flatten)]
pub integration: Integration, pub integration: Integration,
@ -23,7 +23,7 @@ pub struct IntegrationUpdate {
impl WebSocketEvent for IntegrationUpdate {} impl WebSocketEvent for IntegrationUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#integration-delete /// See <https://discord.com/developers/docs/topics/gateway-events#integration-delete>
pub struct IntegrationDelete { pub struct IntegrationDelete {
pub id: Snowflake, pub id: Snowflake,
pub guild_id: Snowflake, pub guild_id: Snowflake,

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{Interaction, WebSocketEvent}; use crate::types::{Interaction, WebSocketEvent};
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#interaction-create /// See <https://discord.com/developers/docs/topics/gateway-events#interaction-create>
pub struct InteractionCreate { pub struct InteractionCreate {
#[serde(flatten)] #[serde(flatten)]
pub interaction: Interaction, pub interaction: Interaction,

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{GuildInvite, Snowflake, WebSocketEvent}; use crate::types::{GuildInvite, Snowflake, WebSocketEvent};
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#invite-create /// See <https://discord.com/developers/docs/topics/gateway-events#invite-create>
pub struct InviteCreate { pub struct InviteCreate {
#[serde(flatten)] #[serde(flatten)]
pub invite: GuildInvite, pub invite: GuildInvite,
@ -12,7 +12,7 @@ pub struct InviteCreate {
impl WebSocketEvent for InviteCreate {} impl WebSocketEvent for InviteCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#invite-delete /// See <https://discord.com/developers/docs/topics/gateway-events#invite-delete>
pub struct InviteDelete { pub struct InviteDelete {
pub channel_id: Snowflake, pub channel_id: Snowflake,
pub guild_id: Option<Snowflake>, pub guild_id: Option<Snowflake>,

View File

@ -13,7 +13,7 @@ use super::WebSocketEvent;
/// Sent by the official client when switching to a guild or channel; /// Sent by the official client when switching to a guild or channel;
/// After this, you should recieve message updates /// After this, you should recieve message updates
/// ///
/// See https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html#op-14-lazy-request /// See <https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html#op-14-lazy-request>
/// ///
/// {"op":14,"d":{"guild_id":"848582562217590824","typing":true,"activities":true,"threads":true}} /// {"op":14,"d":{"guild_id":"848582562217590824","typing":true,"activities":true,"threads":true}}
pub struct LazyRequest { pub struct LazyRequest {

View File

@ -19,7 +19,7 @@ pub struct TypingStartEvent {
impl WebSocketEvent for TypingStartEvent {} impl WebSocketEvent for TypingStartEvent {}
#[derive(Debug, Serialize, Deserialize, Default, Clone)] #[derive(Debug, Serialize, Deserialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#message-create /// See <https://discord.com/developers/docs/topics/gateway-events#message-create>
pub struct MessageCreate { pub struct MessageCreate {
#[serde(flatten)] #[serde(flatten)]
message: Message, message: Message,
@ -29,7 +29,7 @@ pub struct MessageCreate {
} }
#[derive(Debug, Serialize, Deserialize, Default, Clone)] #[derive(Debug, Serialize, Deserialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#message-create-message-create-extra-fields /// See <https://discord.com/developers/docs/topics/gateway-events#message-create-message-create-extra-fields>
pub struct MessageCreateUser { pub struct MessageCreateUser {
#[serde(flatten)] #[serde(flatten)]
user: PublicUser, user: PublicUser,
@ -114,7 +114,7 @@ impl WebSocketEvent for MessageReactionRemoveEmoji {}
/// ///
/// Not documented anywhere unofficially /// Not documented anywhere unofficially
/// ///
/// Apparently "Message ACK refers to marking a message as read for Discord's API." (https://github.com/Rapptz/discord.py/issues/1851) /// Apparently "Message ACK refers to marking a message as read for Discord's API." (<https://github.com/Rapptz/discord.py/issues/1851>)
/// I suspect this is sent and recieved from the gateway to let clients on other devices know the user has read a message /// I suspect this is sent and recieved from the gateway to let clients on other devices know the user has read a message
/// ///
/// {"t":"MESSAGE_ACK","s":3,"op":0,"d":{"version":52,"message_id":"1107236673638633472","last_viewed":null,"flags":null,"channel_id":"967363950217936897"}} /// {"t":"MESSAGE_ACK","s":3,"op":0,"d":{"version":52,"message_id":"1107236673638633472","last_viewed":null,"flags":null,"channel_id":"967363950217936897"}}

View File

@ -57,7 +57,7 @@ pub trait WebSocketEvent {}
#[derive(Debug, Default, Serialize, Clone)] #[derive(Debug, Default, Serialize, Clone)]
/// The payload used for sending events to the gateway /// The payload used for sending events to the gateway
/// ///
/// Similar to [GatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue] /// Similar to [GatewayReceivePayload], except we send a [serde_json::value::Value] for d whilst we receive a [serde_json::value::RawValue]
/// Also, we never need to send the event name /// Also, we never need to send the event name
pub struct GatewaySendPayload { pub struct GatewaySendPayload {
#[serde(rename = "op")] #[serde(rename = "op")]
@ -76,9 +76,6 @@ impl WebSocketEvent for GatewaySendPayload {}
#[derive(Debug, Default, Deserialize, Clone)] #[derive(Debug, Default, Deserialize, Clone)]
/// The payload used for receiving events from the gateway /// The payload used for receiving events from the gateway
///
/// Similar to [GatewaySendPayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
/// Also, we never need to sent the event name
pub struct GatewayReceivePayload<'a> { pub struct GatewayReceivePayload<'a> {
#[serde(rename = "op")] #[serde(rename = "op")]
pub op_code: u8, pub op_code: u8,

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// Sent by the client to update its status and presence; /// Sent by the client to update its status and presence;
/// See https://discord.com/developers/docs/topics/gateway-events#update-presence /// See <https://discord.com/developers/docs/topics/gateway-events#update-presence>
pub struct UpdatePresence { pub struct UpdatePresence {
/// unix time of when the client went idle, or none if client is not idle /// unix time of when the client went idle, or none if client is not idle
pub since: Option<u128>, pub since: Option<u128>,
@ -16,7 +16,7 @@ pub struct UpdatePresence {
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// Received to tell the client that a user updated their presence / status /// Received to tell the client that a user updated their presence / status
/// See https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields /// See <https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields>
pub struct PresenceUpdate { pub struct PresenceUpdate {
pub user: PublicUser, pub user: PublicUser,
#[serde(default)] #[serde(default)]

View File

@ -8,7 +8,7 @@ use crate::types::{Activity, GuildMember, PresenceUpdate, VoiceState};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// 1/2 half documented; /// 1/2 half documented;
/// Received after identifying, provides initial user info; /// Received after identifying, provides initial user info;
/// See https://discord.com/developers/docs/topics/gateway-events#ready; /// See <https://discord.com/developers/docs/topics/gateway-events#ready;>
pub struct GatewayReady { pub struct GatewayReady {
pub analytics_token: Option<String>, pub analytics_token: Option<String>,
pub auth_session_id_hash: Option<String>, pub auth_session_id_hash: Option<String>,
@ -16,7 +16,7 @@ pub struct GatewayReady {
pub v: u8, pub v: u8,
pub user: User, pub user: User,
/// For bots these are [UnavailableGuild]s, for users they are [Guild] /// For bots these are [crate::types::UnavailableGuild]s, for users they are [Guild]
pub guilds: Vec<Guild>, pub guilds: Vec<Guild>,
pub presences: Option<Vec<PresenceUpdate>>, pub presences: Option<Vec<PresenceUpdate>>,
pub sessions: Option<Vec<Session>>, pub sessions: Option<Vec<Session>>,

View File

@ -2,7 +2,7 @@ use crate::types::{events::WebSocketEvent, Relationship, RelationshipType, Snowf
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default)] #[derive(Debug, Deserialize, Serialize, Default)]
/// See https://github.com/spacebarchat/server/issues/204 /// See <https://github.com/spacebarchat/server/issues/204>
pub struct RelationshipAdd { pub struct RelationshipAdd {
#[serde(flatten)] #[serde(flatten)]
pub relationship: Relationship, pub relationship: Relationship,
@ -12,7 +12,7 @@ pub struct RelationshipAdd {
impl WebSocketEvent for RelationshipAdd {} impl WebSocketEvent for RelationshipAdd {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://github.com/spacebarchat/server/issues/203 /// See <https://github.com/spacebarchat/server/issues/203>
pub struct RelationshipRemove { pub struct RelationshipRemove {
pub id: Snowflake, pub id: Snowflake,
#[serde(rename = "type")] #[serde(rename = "type")]

View File

@ -2,7 +2,7 @@ use crate::types::{events::WebSocketEvent, Snowflake};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default)] #[derive(Debug, Deserialize, Serialize, Default)]
/// See https://discord.com/developers/docs/topics/gateway-events#request-guild-members-request-guild-members-structure /// See <https://discord.com/developers/docs/topics/gateway-events#request-guild-members-request-guild-members-structure>
pub struct GatewayRequestGuildMembers { pub struct GatewayRequestGuildMembers {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub query: Option<String>, pub query: Option<String>,

View File

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{StageInstance, WebSocketEvent}; use crate::types::{StageInstance, WebSocketEvent};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#stage-instance-create /// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-create>
pub struct StageInstanceCreate { pub struct StageInstanceCreate {
#[serde(flatten)] #[serde(flatten)]
pub stage_instance: StageInstance, pub stage_instance: StageInstance,
@ -12,7 +12,7 @@ pub struct StageInstanceCreate {
impl WebSocketEvent for StageInstanceCreate {} impl WebSocketEvent for StageInstanceCreate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#stage-instance-update /// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-update>
pub struct StageInstanceUpdate { pub struct StageInstanceUpdate {
#[serde(flatten)] #[serde(flatten)]
pub stage_instance: StageInstance, pub stage_instance: StageInstance,
@ -21,7 +21,7 @@ pub struct StageInstanceUpdate {
impl WebSocketEvent for StageInstanceUpdate {} impl WebSocketEvent for StageInstanceUpdate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#stage-instance-delete /// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-delete>
pub struct StageInstanceDelete { pub struct StageInstanceDelete {
#[serde(flatten)] #[serde(flatten)]
pub stage_instance: StageInstance, pub stage_instance: StageInstance,

View File

@ -5,7 +5,7 @@ use crate::types::events::WebSocketEvent;
use crate::types::Snowflake; use crate::types::Snowflake;
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-create /// See <https://discord.com/developers/docs/topics/gateway-events#thread-create>
pub struct ThreadCreate { pub struct ThreadCreate {
#[serde(flatten)] #[serde(flatten)]
pub thread: Channel, pub thread: Channel,
@ -14,7 +14,7 @@ pub struct ThreadCreate {
impl WebSocketEvent for ThreadCreate {} impl WebSocketEvent for ThreadCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-update /// See <https://discord.com/developers/docs/topics/gateway-events#thread-update>
pub struct ThreadUpdate { pub struct ThreadUpdate {
#[serde(flatten)] #[serde(flatten)]
pub thread: Channel, pub thread: Channel,
@ -23,7 +23,7 @@ pub struct ThreadUpdate {
impl WebSocketEvent for ThreadUpdate {} impl WebSocketEvent for ThreadUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-delete /// See <https://discord.com/developers/docs/topics/gateway-events#thread-delete>
pub struct ThreadDelete { pub struct ThreadDelete {
#[serde(flatten)] #[serde(flatten)]
pub thread: Channel, pub thread: Channel,
@ -32,7 +32,7 @@ pub struct ThreadDelete {
impl WebSocketEvent for ThreadDelete {} impl WebSocketEvent for ThreadDelete {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-list-sync /// See <https://discord.com/developers/docs/topics/gateway-events#thread-list-sync>
pub struct ThreadListSync { pub struct ThreadListSync {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub channel_ids: Option<Vec<Snowflake>>, pub channel_ids: Option<Vec<Snowflake>>,
@ -43,7 +43,7 @@ pub struct ThreadListSync {
impl WebSocketEvent for ThreadListSync {} impl WebSocketEvent for ThreadListSync {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-member-update /// See <https://discord.com/developers/docs/topics/gateway-events#thread-member-update>
/// The inner payload is a thread member object with an extra field. /// The inner payload is a thread member object with an extra field.
pub struct ThreadMemberUpdate { pub struct ThreadMemberUpdate {
#[serde(flatten)] #[serde(flatten)]
@ -54,7 +54,7 @@ pub struct ThreadMemberUpdate {
impl WebSocketEvent for ThreadMemberUpdate {} impl WebSocketEvent for ThreadMemberUpdate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#thread-members-update /// See <https://discord.com/developers/docs/topics/gateway-events#thread-members-update>
pub struct ThreadMembersUpdate { pub struct ThreadMembersUpdate {
pub id: Snowflake, pub id: Snowflake,
pub guild_id: Snowflake, pub guild_id: Snowflake,

View File

@ -5,7 +5,7 @@ use crate::types::events::WebSocketEvent;
use crate::types::utils::Snowflake; use crate::types::utils::Snowflake;
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#user-update; /// See <https://discord.com/developers/docs/topics/gateway-events#user-update>;
/// Sent to indicate updates to a user object; (name changes, discriminator changes, etc); /// Sent to indicate updates to a user object; (name changes, discriminator changes, etc);
pub struct UserUpdate { pub struct UserUpdate {
#[serde(flatten)] #[serde(flatten)]

View File

@ -16,7 +16,7 @@ pub struct UpdateVoiceState {
impl WebSocketEvent for UpdateVoiceState {} impl WebSocketEvent for UpdateVoiceState {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#voice-state-update; /// See <https://discord.com/developers/docs/topics/gateway-events#voice-state-update>;
/// ///
/// Received from the server to indicate an update in a user's voice state (leave voice channel, join voice channel, mute, deafen, etc); /// Received from the server to indicate an update in a user's voice state (leave voice channel, join voice channel, mute, deafen, etc);
/// ///
@ -29,7 +29,7 @@ pub struct VoiceStateUpdate {
impl WebSocketEvent for VoiceStateUpdate {} impl WebSocketEvent for VoiceStateUpdate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#voice-server-update; /// See <https://discord.com/developers/docs/topics/gateway-events#voice-server-update>;
/// ///
/// Received to indicate which voice endpoint, token and guild_id to use; /// Received to indicate which voice endpoint, token and guild_id to use;
pub struct VoiceServerUpdate { pub struct VoiceServerUpdate {

View File

@ -5,7 +5,7 @@ use crate::types::Snowflake;
use super::WebSocketEvent; use super::WebSocketEvent;
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#webhooks-update /// See <https://discord.com/developers/docs/topics/gateway-events#webhooks-update>
pub struct WebhooksUpdate { pub struct WebhooksUpdate {
pub guild_id: Snowflake, pub guild_id: Snowflake,
pub channel_id: Snowflake, pub channel_id: Snowflake,

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// See https://discord.com/developers/docs/topics/gateway-events#client-status-object /// See <https://discord.com/developers/docs/topics/gateway-events#client-status-object>
pub struct ClientStatusObject { pub struct ClientStatusObject {
pub desktop: Option<String>, pub desktop: Option<String>,
pub mobile: Option<String>, pub mobile: Option<String>,

View File

@ -11,7 +11,7 @@ use sqlx::Type;
const EPOCH: i64 = 1420070400000; const EPOCH: i64 = 1420070400000;
/// Unique identifier including a timestamp. /// Unique identifier including a timestamp.
/// See https://discord.com/developers/docs/reference#snowflakes /// See <https://discord.com/developers/docs/reference#snowflakes>
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "sqlx", derive(Type))] #[cfg_attr(feature = "sqlx", derive(Type))]
#[cfg_attr(feature = "sqlx", sqlx(transparent))] #[cfg_attr(feature = "sqlx", sqlx(transparent))]