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