1mod network;
6mod quota;
7mod rid;
8
9pub use network::*;
10pub use quota::*;
11pub use rid::*;
12
13use wechat_mp_core::MpClient;
14
15#[derive(Clone)]
17pub struct OpsApi {
18 client: MpClient,
19}
20
21impl OpsApi {
22 pub fn new(client: MpClient) -> Self {
23 Self { client }
24 }
25
26 pub fn client(&self) -> &MpClient {
27 &self.client
28 }
29
30 pub async fn get_api_domain_ip(&self) -> wechat_mp_core::Result<IpListResponse> {
32 get_api_domain_ip(&self.client).await
33 }
34
35 pub async fn get_callback_ip(&self) -> wechat_mp_core::Result<IpListResponse> {
37 get_callback_ip(&self.client).await
38 }
39
40 pub async fn callback_check(
42 &self,
43 req: &CallbackCheckRequest,
44 ) -> wechat_mp_core::Result<CallbackCheckResponse> {
45 callback_check(&self.client, req).await
46 }
47
48 pub async fn get_api_quota(
50 &self,
51 cgi_path: impl Into<String>,
52 ) -> wechat_mp_core::Result<GetQuotaResponse> {
53 get_api_quota(&self.client, &GetQuotaRequest::new(cgi_path)).await
54 }
55
56 pub async fn clear_quota(&self, appid: impl Into<String>) -> wechat_mp_core::Result<()> {
58 clear_quota(&self.client, appid).await
59 }
60
61 pub async fn clear_quota_self(&self) -> wechat_mp_core::Result<()> {
63 clear_quota_self(&self.client).await
64 }
65
66 pub async fn clear_api_quota(
68 &self,
69 cgi_path: impl Into<String>,
70 ) -> wechat_mp_core::Result<()> {
71 clear_api_quota(&self.client, cgi_path).await
72 }
73
74 pub async fn clear_quota_by_secret(
76 &self,
77 appid: impl Into<String>,
78 appsecret: impl Into<String>,
79 ) -> wechat_mp_core::Result<()> {
80 clear_quota_by_secret(&self.client, appid, appsecret).await
81 }
82
83 pub async fn clear_quota_by_secret_self(&self) -> wechat_mp_core::Result<()> {
85 clear_quota_by_secret_self(&self.client).await
86 }
87
88 pub async fn get_rid_info(
90 &self,
91 rid: impl Into<String>,
92 ) -> wechat_mp_core::Result<GetRidResponse> {
93 get_rid_info(&self.client, rid).await
94 }
95}