mastodon_api\methods\admin/
domain_federation.rs

1use crate::MastodonClient;
2use crate::error::Result;
3
4/// Handler for admin domain federation API endpoints.
5pub struct AdminDomainFederationHandler<'a> {
6    client: &'a MastodonClient,
7}
8
9impl<'a> AdminDomainFederationHandler<'a> {
10    pub fn new(client: &'a MastodonClient) -> Self {
11        Self { client }
12    }
13
14    /// Fetches all allowed domains.
15    pub async fn list_allows(&self) -> Result<serde_json::Value> {
16        let url = format!("{}/api/v1/admin/domain_allows", self.client.base_url());
17        let req = self.client.http_client().get(&url);
18        self.client.send(req).await
19    }
20
21    /// Fetches all blocked domains.
22    pub async fn list_blocks(&self) -> Result<serde_json::Value> {
23        let url = format!("{}/api/v1/admin/domain_blocks", self.client.base_url());
24        let req = self.client.http_client().get(&url);
25        self.client.send(req).await
26    }
27}