/* -> ///
This commit is contained in:
parent
69b7c2445c
commit
192f12d892
|
@ -9,17 +9,15 @@ use crate::ratelimiter::ChorusRequest;
|
|||
use crate::types::{Message, MessageSendSchema, PartialDiscordFileAttachment, Snowflake};
|
||||
|
||||
impl Message {
|
||||
/**
|
||||
Sends a message to the Spacebar server.
|
||||
# Arguments
|
||||
* `url_api` - The URL of the Spacebar server's API.
|
||||
* `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
|
||||
* [`ChorusLibError`] - If the message cannot be sent.
|
||||
*/
|
||||
/// Sends a message to the Spacebar server.
|
||||
/// # Arguments
|
||||
/// * `url_api` - The URL of the Spacebar server's API.
|
||||
/// * `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
|
||||
/// * [`ChorusLibError`] - If the message cannot be sent.
|
||||
pub async fn send(
|
||||
user: &mut UserMeta,
|
||||
channel_id: Snowflake,
|
||||
|
@ -78,18 +76,17 @@ impl Message {
|
|||
}
|
||||
|
||||
impl UserMeta {
|
||||
/// Sends a message to the Spacebar server.
|
||||
/// # Arguments
|
||||
/// * `url_api` - The URL of the Spacebar server's API.
|
||||
/// * `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
|
||||
/// * [`ChorusLibError`] - If the message cannot be sent.
|
||||
/// # Notes
|
||||
/// Shorthand call for Message::send()
|
||||
/**
|
||||
Sends a message to the Spacebar server.
|
||||
# Arguments
|
||||
* `url_api` - The URL of the Spacebar server's API.
|
||||
* `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
|
||||
* [`ChorusLibError`] - If the message cannot be sent.
|
||||
*/
|
||||
pub async fn send_message(
|
||||
&mut self,
|
||||
message: &mut MessageSendSchema,
|
||||
|
|
|
@ -8,9 +8,7 @@ use crate::{
|
|||
types::{self, PublicUser, Snowflake},
|
||||
};
|
||||
|
||||
/**
|
||||
Useful metadata for working with [`types::Reaction`], bundled together nicely.
|
||||
*/
|
||||
/// Useful metadata for working with [`types::Reaction`], bundled together nicely.
|
||||
pub struct ReactionMeta {
|
||||
pub message_id: types::Snowflake,
|
||||
pub channel_id: types::Snowflake,
|
||||
|
|
|
@ -140,16 +140,14 @@ impl User {
|
|||
}
|
||||
|
||||
impl Instance {
|
||||
/**
|
||||
Get a user object by id, or get the current user.
|
||||
# Arguments
|
||||
* `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.
|
||||
# Errors
|
||||
* [`ChorusLibError`] - If the request fails.
|
||||
# Notes
|
||||
This function is a wrapper around [`User::get`].
|
||||
*/
|
||||
// Get a user object by id, or get the current user.
|
||||
// # Arguments
|
||||
// * `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.
|
||||
// # Errors
|
||||
// * [`ChorusLibError`] - If the request fails.
|
||||
// # Notes
|
||||
// This function is a wrapper around [`User::get`].
|
||||
pub async fn get_user(&mut self, token: String, id: Option<&String>) -> ChorusResult<User> {
|
||||
let mut user = UserMeta::shell(Rc::new(RefCell::new(self.clone())), token);
|
||||
let result = User::get(&mut user, id).await;
|
||||
|
|
|
@ -14,10 +14,8 @@ use crate::types::{GeneralConfiguration, User, UserSettings};
|
|||
use crate::UrlBundle;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
/**
|
||||
The [`Instance`] what you will be using to perform all sorts of actions on the Spacebar server.
|
||||
If `limits_information` is `None`, then the instance will not be rate limited.
|
||||
*/
|
||||
/// The [`Instance`]; what you will be using to perform all sorts of actions on the Spacebar server.
|
||||
/// If `limits_information` is `None`, then the instance will not be rate limited.
|
||||
pub struct Instance {
|
||||
pub urls: UrlBundle,
|
||||
pub instance_info: GeneralConfiguration,
|
||||
|
|
|
@ -41,11 +41,7 @@ pub struct PartialDiscordFileAttachment {
|
|||
}
|
||||
|
||||
impl PartialDiscordFileAttachment {
|
||||
/**
|
||||
Moves `self.content` out of `self` and returns it.
|
||||
# Returns
|
||||
Vec<u8>
|
||||
*/
|
||||
/// Moves `self.content` out of `self` and returns it.
|
||||
pub fn move_content(self) -> (Vec<u8>, PartialDiscordFileAttachment) {
|
||||
let content = self.content;
|
||||
let updated_struct = PartialDiscordFileAttachment {
|
||||
|
|
Loading…
Reference in New Issue