pub struct WeChatHttpClient { /* private fields */ }
Expand description
HTTP client wrapper for WeChat API calls with automatic retry and token management.
Implementations§
Source§impl WeChatHttpClient
impl WeChatHttpClient
Sourcepub fn with_config(config: Config) -> Result<Self>
pub fn with_config(config: Config) -> Result<Self>
Creates a new client with custom configuration.
Sourcepub fn with_retry_config(retry_config: RetryConfig) -> Result<Self>
pub fn with_retry_config(retry_config: RetryConfig) -> Result<Self>
Creates a new client with custom retry configuration (legacy).
Sourcepub fn with_security_config(security_config: SecurityConfig) -> Result<Self>
pub fn with_security_config(security_config: SecurityConfig) -> Result<Self>
Creates a new client with custom security configuration (legacy).
Sourcepub async fn get_with_token(
&self,
endpoint: &str,
access_token: &str,
) -> Result<Response>
pub async fn get_with_token( &self, endpoint: &str, access_token: &str, ) -> Result<Response>
Makes a GET request with access token.
Sourcepub async fn post_json_with_token<T: Serialize>(
&self,
endpoint: &str,
access_token: &str,
body: &T,
) -> Result<Response>
pub async fn post_json_with_token<T: Serialize>( &self, endpoint: &str, access_token: &str, body: &T, ) -> Result<Response>
Makes a POST request with JSON body and access token.
Sourcepub async fn upload_file(
&self,
endpoint: &str,
access_token: &str,
field_name: &str,
file_data: Vec<u8>,
filename: &str,
) -> Result<Response>
pub async fn upload_file( &self, endpoint: &str, access_token: &str, field_name: &str, file_data: Vec<u8>, filename: &str, ) -> Result<Response>
Uploads a file using multipart form data with size validation.
Trait Implementations§
Source§impl Clone for WeChatHttpClient
impl Clone for WeChatHttpClient
Source§fn clone(&self) -> WeChatHttpClient
fn clone(&self) -> WeChatHttpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WeChatHttpClient
impl Debug for WeChatHttpClient
Source§impl HttpClient for WeChatHttpClient
impl HttpClient for WeChatHttpClient
Source§fn get_with_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_with_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Makes a GET request with token.
Source§fn post_json_with_token<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
body: &'life3 T,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
fn post_json_with_token<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, endpoint: &'life1 str, token: &'life2 str, body: &'life3 T, ) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
Makes a POST request with JSON body and token.
Source§fn upload_file<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
field_name: &'life3 str,
file_data: Vec<u8>,
filename: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn upload_file<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
endpoint: &'life1 str,
token: &'life2 str,
field_name: &'life3 str,
file_data: Vec<u8>,
filename: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Uploads a file using multipart form data.
Auto Trait Implementations§
impl Freeze for WeChatHttpClient
impl !RefUnwindSafe for WeChatHttpClient
impl Send for WeChatHttpClient
impl Sync for WeChatHttpClient
impl Unpin for WeChatHttpClient
impl !UnwindSafe for WeChatHttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more