Add some docs
This commit is contained in:
parent
7cdaf35583
commit
d3613702bb
|
@ -11,6 +11,7 @@ use crate::ratelimiter::ChorusRequest;
|
|||
use crate::types::{LoginResult, LoginSchema};
|
||||
|
||||
impl Instance {
|
||||
/// Logs into an existing account on the spacebar server.
|
||||
pub async fn login_account(&mut self, login_schema: &LoginSchema) -> ChorusResult<UserMeta> {
|
||||
let endpoint_url = self.urls.api.clone() + "/auth/login";
|
||||
let chorus_request = ChorusRequest {
|
||||
|
|
|
@ -12,15 +12,7 @@ use crate::{
|
|||
};
|
||||
|
||||
impl Instance {
|
||||
/// Registers a new user on the Spacebar server.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `register_schema` - The [`RegisterSchema`] that contains all the information that is needed to register a new user.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * [`crate::errors::ChorusError`] - If the server does not respond.
|
||||
/// Registers a new user on the server.
|
||||
pub async fn register_account(
|
||||
&mut self,
|
||||
register_schema: &RegisterSchema,
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::{
|
|||
};
|
||||
|
||||
impl Channel {
|
||||
/// Retrieves a channel from the server.
|
||||
pub async fn get(user: &mut UserMeta, channel_id: Snowflake) -> ChorusResult<Channel> {
|
||||
let url = user.belongs_to.borrow().urls.api.clone();
|
||||
let chorus_request = ChorusRequest {
|
||||
|
@ -21,19 +22,7 @@ impl Channel {
|
|||
chorus_request.deserialize_response::<Channel>(user).await
|
||||
}
|
||||
|
||||
/// Deletes a channel.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `token` - A string slice that holds the authorization token.
|
||||
/// * `url_api` - A string slice that holds the URL of the API.
|
||||
/// * `channel` - A `Channel` object that represents the channel to be deleted.
|
||||
/// * `limits_user` - A mutable reference to a `Limits` object that represents the user's rate limits.
|
||||
/// * `limits_instance` - A mutable reference to a `Limits` object that represents the instance's rate limits.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `Result` that contains a `ChorusLibError` if an error occurred during the request, or `()` if the request was successful.
|
||||
/// Deletes self.
|
||||
pub async fn delete(self, user: &mut UserMeta) -> ChorusResult<()> {
|
||||
let chorus_request = ChorusRequest {
|
||||
request: Client::new()
|
||||
|
@ -48,20 +37,8 @@ impl Channel {
|
|||
chorus_request.handle_request_as_result(user).await
|
||||
}
|
||||
|
||||
/// Modifies a channel.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `modify_data` - A `ChannelModifySchema` object that represents the modifications to be made to the channel.
|
||||
/// * `token` - A string slice that holds the authorization token.
|
||||
/// * `url_api` - A string slice that holds the URL of the API.
|
||||
/// * `channel_id` - A string slice that holds the ID of the channel to be modified.
|
||||
/// * `limits_user` - A mutable reference to a `Limits` object that represents the user's rate limits.
|
||||
/// * `limits_instance` - A mutable reference to a `Limits` object that represents the instance's rate limits.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `Result` that contains a `Channel` object if the request was successful, or an `ChorusLibError` if an error occurred during the request.
|
||||
/// Modifies a channel with the provided data.
|
||||
/// Replaces self with the new channel object.
|
||||
pub async fn modify(
|
||||
&mut self,
|
||||
modify_data: ChannelModifySchema,
|
||||
|
@ -84,6 +61,7 @@ impl Channel {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Fetches recent messages from a channel.
|
||||
pub async fn messages(
|
||||
range: GetChannelMessagesSchema,
|
||||
channel_id: Snowflake,
|
||||
|
|
Loading…
Reference in New Issue