diff --git a/src/api/channels/channels.rs b/src/api/channels/channels.rs index 21026b6..4193933 100644 --- a/src/api/channels/channels.rs +++ b/src/api/channels/channels.rs @@ -58,23 +58,22 @@ impl Channel { /// # Returns /// /// An `Option` that contains an `InstanceServerError` if an error occurred during the request, or `None` if the request was successful. - pub async fn delete( - self, - token: &str, - url_api: &str, - limits_user: &mut Limits, - limits_instance: &mut Limits, - ) -> Option { + pub async fn delete(self, user: &mut UserMeta) -> Option { + let mut belongs_to = user.belongs_to.borrow_mut(); let request = Client::new() - .delete(format!("{}/channels/{}/", url_api, self.id.to_string())) - .bearer_auth(token); + .delete(format!( + "{}/channels/{}/", + belongs_to.urls.get_api(), + self.id.to_string() + )) + .bearer_auth(user.token()); match LimitedRequester::new() .await .send_request( request, crate::api::limits::LimitType::Channel, - limits_instance, - limits_user, + &mut belongs_to.limits, + &mut user.limits, ) .await { diff --git a/tests/channel.rs b/tests/channel.rs index 58776b0..101fe8a 100644 --- a/tests/channel.rs +++ b/tests/channel.rs @@ -19,16 +19,7 @@ async fn get_channel() { #[tokio::test] async fn delete_channel() { let mut bundle = common::setup().await; - let result = bundle - .channel - .clone() - .delete( - &bundle.user.token, - bundle.instance.urls.get_api(), - &mut bundle.user.limits, - &mut bundle.instance.limits, - ) - .await; + let result = bundle.channel.clone().delete(&mut bundle.user).await; assert!(result.is_none()); common::teardown(bundle).await }