chore: C-GETTER (sort of)
This commit is contained in:
parent
8e94e8d284
commit
a3f8a0492b
|
@ -47,6 +47,7 @@ impl ReactionMeta {
|
||||||
///
|
///
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/resources/channel#get-reactions>
|
/// See <https://discord.com/developers/docs/resources/channel#get-reactions>
|
||||||
|
// Consider renaming this, maybe get_reaction_users or get_emoji_users
|
||||||
pub async fn get(&self, emoji: &str, user: &mut ChorusUser) -> ChorusResult<Vec<PublicUser>> {
|
pub async fn get(&self, emoji: &str, user: &mut ChorusUser) -> ChorusResult<Vec<PublicUser>> {
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/channels/{}/messages/{}/reactions/{}",
|
"{}/channels/{}/messages/{}/reactions/{}",
|
||||||
|
|
|
@ -191,10 +191,13 @@ impl Guild {
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a guild preview object for the given guild ID. If the user is not in the guild, the guild must be discoverable.
|
/// Fetches a guild preview object for the given guild ID. If the user is not in the guild, the guild must be discoverable.
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-preview>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-preview>
|
||||||
|
// RAGC: These aren't just getters, they fetch something on the server.
|
||||||
|
// I am going to excuse these namings, since .preview() indicates we are just returning
|
||||||
|
// something we have already saved.
|
||||||
pub async fn get_preview(
|
pub async fn get_preview(
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
user: &mut ChorusUser,
|
user: &mut ChorusUser,
|
||||||
|
@ -216,7 +219,7 @@ impl Guild {
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of guild member objects that are members of the guild.
|
/// Fetches a list of guild member objects that are members of the guild.
|
||||||
///
|
///
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-members>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-members>
|
||||||
|
@ -383,7 +386,7 @@ impl Guild {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of ban objects for the guild. Requires the `BAN_MEMBERS` permission.
|
/// Fetches a list of ban objects for the guild. Requires the `BAN_MEMBERS` permission.
|
||||||
///
|
///
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-bans>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-bans>
|
||||||
|
@ -413,7 +416,7 @@ impl Guild {
|
||||||
request.deserialize_response::<Vec<GuildBan>>(user).await
|
request.deserialize_response::<Vec<GuildBan>>(user).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a ban object for the given user. Requires the `BAN_MEMBERS` permission.
|
/// Fetches a ban object for the given user. Requires the `BAN_MEMBERS` permission.
|
||||||
///
|
///
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-ban>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#get-guild-ban>
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl ChorusUser {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of user guild objects representing the guilds the current user is a member of.
|
/// Fetches a list of user guild objects representing the guilds the current user is a member of.
|
||||||
/// This endpoint returns 200 guilds by default
|
/// This endpoint returns 200 guilds by default
|
||||||
///
|
///
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
impl ChorusUser {
|
impl ChorusUser {
|
||||||
/// Gets a user by id, or if the id is None, gets the current user.
|
/// Fetches a user by id, or if the id is None, gets the current user.
|
||||||
///
|
///
|
||||||
/// # Notes
|
/// # Notes
|
||||||
/// This function is a wrapper around [`User::get`].
|
/// This function is a wrapper around [`User::get`].
|
||||||
|
@ -23,7 +23,7 @@ impl ChorusUser {
|
||||||
User::get(self, id).await
|
User::get(self, id).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the user's settings.
|
/// Fetches the user's settings.
|
||||||
///
|
///
|
||||||
/// # Notes
|
/// # Notes
|
||||||
/// This functions is a wrapper around [`User::get_settings`].
|
/// This functions is a wrapper around [`User::get_settings`].
|
||||||
|
@ -82,7 +82,7 @@ impl ChorusUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl User {
|
impl User {
|
||||||
/// Gets a user by id, or if the id is None, gets the current user.
|
/// Fetches a user by id, or if the id is None, gets the current user.
|
||||||
///
|
///
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/user#get-user> and
|
/// See <https://discord-userdoccers.vercel.app/resources/user#get-user> and
|
||||||
|
@ -110,7 +110,7 @@ impl User {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the user's settings.
|
/// Fetches the user's settings.
|
||||||
///
|
///
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://luna.gitlab.io/discord-unofficial-docs/user_settings.html#get-users-me-settings>
|
/// See <https://luna.gitlab.io/discord-unofficial-docs/user_settings.html#get-users-me-settings>
|
||||||
|
|
|
@ -342,7 +342,7 @@ impl ChorusRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the ratelimit configuration.
|
/// Fetches the ratelimit configuration.
|
||||||
///
|
///
|
||||||
/// # Notes
|
/// # Notes
|
||||||
/// This is a spacebar only endpoint.
|
/// This is a spacebar only endpoint.
|
||||||
|
|
|
@ -140,6 +140,8 @@ where
|
||||||
|
|
||||||
pub(crate) trait JsonField: Clone {
|
pub(crate) trait JsonField: Clone {
|
||||||
fn set_json(&mut self, json: String);
|
fn set_json(&mut self, json: String);
|
||||||
|
// RAGC: Perhaps this and get_source_url should be renamed, but that requires a new version of
|
||||||
|
// the macros crate aswell, and I don't know if it's worth it
|
||||||
fn get_json(&self) -> String;
|
fn get_json(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue