Add channel delete method

This commit is contained in:
bitfl0wer 2023-05-28 22:39:25 +02:00
parent 2e81f5c4e1
commit ed330859bd
1 changed files with 25 additions and 0 deletions

View File

@ -38,4 +38,29 @@ impl Channel {
}),
}
}
pub async fn delete(
token: &str,
url_api: &str,
channel_id: &str,
limits_user: &mut Limits,
limits_instance: &mut Limits,
) -> Option<InstanceServerError> {
let request = Client::new()
.delete(format!("{}/channels/{}/", url_api, channel_id))
.bearer_auth(token);
match LimitedRequester::new()
.await
.send_request(
request,
crate::api::limits::LimitType::Channel,
limits_instance,
limits_user,
)
.await
{
Ok(_) => None,
Err(e) => return Some(e),
}
}
}