Add documentation
This commit is contained in:
parent
1934622e4c
commit
ea454228ac
|
@ -4,6 +4,34 @@ use crate::api::schemas;
|
|||
use crate::api::types;
|
||||
|
||||
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(
|
||||
user: &mut types::User<'a>,
|
||||
instance: &mut crate::instance::Instance,
|
||||
|
|
Loading…
Reference in New Issue