diff --git a/src/api/guilds/guilds.rs b/src/api/guilds/guilds.rs index aef5eb4..118a25e 100644 --- a/src/api/guilds/guilds.rs +++ b/src/api/guilds/guilds.rs @@ -122,19 +122,17 @@ impl Guild { /// A `Result` containing a `reqwest::Response` if the request was successful, or an `InstanceServerError` if there was an error. pub async fn create_channel( &self, - url_api: &str, - token: &str, + user: &mut UserMeta, schema: ChannelCreateSchema, - limits_user: &mut Limits, - limits_instance: &mut Limits, ) -> Result { - Channel::create( - token, - url_api, + let mut belongs_to = user.belongs_to.borrow_mut(); + Channel::_create( + &user.token, + &format!("{}", belongs_to.urls.get_api()), &self.id.to_string(), schema, - limits_user, - limits_instance, + &mut user.limits, + &mut belongs_to.limits, ) .await } @@ -261,6 +259,23 @@ impl Channel { /// /// A `Result` containing a `reqwest::Response` if the request was successful, or an `InstanceServerError` if there was an error. pub async fn create( + user: &mut UserMeta, + guild_id: &str, + schema: ChannelCreateSchema, + ) -> Result { + let mut belongs_to = user.belongs_to.borrow_mut(); + Channel::_create( + &user.token, + &format!("{}", belongs_to.urls.get_api()), + guild_id, + schema, + &mut user.limits, + &mut belongs_to.limits, + ) + .await + } + + async fn _create( token: &str, url_api: &str, guild_id: &str, diff --git a/tests/common/mod.rs b/tests/common/mod.rs index f8991e3..4b20399 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -66,16 +66,9 @@ pub async fn setup() -> TestBundle { }; let mut user = instance.register_account(®).await.unwrap(); let guild = Guild::create(&mut user, guild_create_schema).await.unwrap(); - let channel = Channel::create( - &user.token, - urls.get_api(), - &guild.id.to_string(), - channel_create_schema, - &mut user.limits, - &mut instance.limits, - ) - .await - .unwrap(); + let channel = Channel::create(&mut user, &guild.id.to_string(), channel_create_schema) + .await + .unwrap(); TestBundle { urls,