Add documentation

This commit is contained in:
bitfl0wer 2023-05-13 22:55:17 +02:00
parent 1934622e4c
commit ea454228ac
1 changed files with 28 additions and 0 deletions

View File

@ -4,6 +4,34 @@ use crate::api::schemas;
use crate::api::types; use crate::api::types;
impl<'a> types::Guild { impl<'a> types::Guild {
/// Creates a new guild with the given parameters.
///
/// # Arguments
///
/// * `user` - A mutable reference to the user creating the guild.
/// * `instance` - A mutable reference to the instance where the guild will be created.
/// * `guild_create_schema` - A reference to the schema containing the guild creation parameters.
///
/// # Returns
///
/// A `Result<String>` containing the ID of the newly created guild, or an error if the request fails.
///
/// # Errors
///
/// Returns an `InstanceServerError` if the request fails.
///
/// # Examples
///
/// ```rust
/// let guild_create_schema = chorus::api::schemas::GuildCreateSchema::new(insert args here);
///
/// let result = Guild::create(&mut user, &mut instance, &guild_create_schema).await;
///
/// match result {
/// Ok(guild_id) => println!("Created guild with ID {}", guild_id),
/// Err(e) => println!("Failed to create guild: {}", e),
/// }
/// ```
pub async fn create( pub async fn create(
user: &mut types::User<'a>, user: &mut types::User<'a>,
instance: &mut crate::instance::Instance, instance: &mut crate::instance::Instance,