pub struct OpenApiApi { /* private fields */ }Expand description
OpenAPI Management API
Provides methods for managing API quotas, debugging, and server info.
Implementations§
Source§impl OpenApiApi
impl OpenApiApi
Sourcepub fn new(context: Arc<WechatContext>) -> Self
pub fn new(context: Arc<WechatContext>) -> Self
Create a new OpenApiApi instance
Sourcepub async fn clear_quota(&self) -> Result<(), WechatError>
pub async fn clear_quota(&self) -> Result<(), WechatError>
Clear all API call quotas for this appid
POST /cgi-bin/clear_quota?access_token=ACCESS_TOKEN
§Returns
Ok(()) on success
Sourcepub async fn get_api_quota(
&self,
cgi_path: &str,
) -> Result<ApiQuotaResponse, WechatError>
pub async fn get_api_quota( &self, cgi_path: &str, ) -> Result<ApiQuotaResponse, WechatError>
Get API call quota for a specific endpoint
POST /cgi-bin/openapi/quota/get?access_token=ACCESS_TOKEN
§Arguments
cgi_path- The API path to query (e.g., “/cgi-bin/message/custom/send”)
Sourcepub async fn clear_api_quota(&self, cgi_path: &str) -> Result<(), WechatError>
pub async fn clear_api_quota(&self, cgi_path: &str) -> Result<(), WechatError>
Clear API call quota for a specific endpoint
POST /cgi-bin/openapi/quota/clear?access_token=ACCESS_TOKEN
§Arguments
cgi_path- The API path to clear quota for
Sourcepub async fn clear_quota_by_app_secret(&self) -> Result<(), WechatError>
pub async fn clear_quota_by_app_secret(&self) -> Result<(), WechatError>
Clear all API call quotas using AppSecret (no access_token required)
POST /cgi-bin/clear_quota/v2
This endpoint authenticates with appid + appsecret directly, bypassing the access_token mechanism.
Sourcepub async fn get_rid_info(
&self,
rid: &str,
) -> Result<RidInfoResponse, WechatError>
pub async fn get_rid_info( &self, rid: &str, ) -> Result<RidInfoResponse, WechatError>
Get request debug information by rid
POST /cgi-bin/openapi/rid/get?access_token=ACCESS_TOKEN
§Arguments
rid- The request ID to look up
Sourcepub async fn callback_check(
&self,
action: &str,
check_operator: &str,
) -> Result<CallbackCheckResponse, WechatError>
pub async fn callback_check( &self, action: &str, check_operator: &str, ) -> Result<CallbackCheckResponse, WechatError>
Check callback URL connectivity
POST /cgi-bin/callback/check?access_token=ACCESS_TOKEN
§Arguments
action- Check action type (e.g., “all”, “dns”, “ping”)check_operator- Operator to check (e.g., “DEFAULT”, “CHINANET”, “UNICOM”, “CAP”)
Sourcepub async fn get_api_domain_ip(&self) -> Result<IpListResponse, WechatError>
pub async fn get_api_domain_ip(&self) -> Result<IpListResponse, WechatError>
Get WeChat API server IP addresses
GET /cgi-bin/get_api_domain_ip?access_token=ACCESS_TOKEN
Sourcepub async fn get_callback_ip(&self) -> Result<IpListResponse, WechatError>
pub async fn get_callback_ip(&self) -> Result<IpListResponse, WechatError>
Get WeChat callback server IP addresses
GET /cgi-bin/getcallbackip?access_token=ACCESS_TOKEN