From ea454228ac0d4e1e4c6352ed165b6ed9ce32660c Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sat, 13 May 2023 22:55:17 +0200 Subject: [PATCH] Add documentation --- src/api/guilds/guilds.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/api/guilds/guilds.rs b/src/api/guilds/guilds.rs index d3fd17a..b067b05 100644 --- a/src/api/guilds/guilds.rs +++ b/src/api/guilds/guilds.rs @@ -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` 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,