use reqwest::Method;
use super::OpenApiDocument;
use crate::{Client, Result, client::AuthenticationScope};
#[derive(Clone, Copy, Debug)]
pub struct PanelApi<'client> {
client: &'client Client,
}
impl<'client> PanelApi<'client> {
pub(crate) const fn new(client: &'client Client) -> Self {
Self { client }
}
pub async fn openapi(self) -> Result<OpenApiDocument> {
self.client
.execute_response::<OpenApiDocument, ()>(
Method::GET,
"panel/api/openapi.json",
None,
AuthenticationScope::PanelApi,
)
.await
}
pub async fn backup_to_telegram(self) -> Result<()> {
self.client
.execute_empty::<()>(
Method::POST,
"panel/api/backuptotgbot",
None,
AuthenticationScope::PanelApi,
)
.await
}
}