cloudreve_sdk_api/api/
site.rs1use crate::client::{Client, RequestOptions};
2use crate::error::ApiResult;
3use crate::models::site::*;
4use async_trait::async_trait;
5
6#[async_trait]
8pub trait SiteApi {
9 async fn get_site_config(&self, section: &str) -> ApiResult<SiteConfig>;
11
12 async fn get_captcha(&self) -> ApiResult<CaptchaResponse>;
14
15 async fn create_abuse_report(&self, request: &CreateAbuseReportService) -> ApiResult<()>;
17}
18
19#[async_trait]
20impl SiteApi for Client {
21 async fn get_site_config(&self, section: &str) -> ApiResult<SiteConfig> {
22 self.get(
23 &format!("/site/config/{}", section),
24 RequestOptions::new().no_credential(),
25 ).await
26 }
27
28 async fn get_captcha(&self) -> ApiResult<CaptchaResponse> {
29 self.get("/site/captcha", RequestOptions::new().no_credential()).await
30 }
31
32 async fn create_abuse_report(&self, request: &CreateAbuseReportService) -> ApiResult<()> {
33 self.post(
34 "/site/abuse",
35 request,
36 RequestOptions::new().no_credential(),
37 ).await
38 }
39}
40