pub struct WechatClientBuilder { /* private fields */ }Expand description
Builder for WechatClient
§Example
use wechat_mp_sdk::client::WechatClient;
use wechat_mp_sdk::types::{AppId, AppSecret};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let appid = AppId::new("wx1234567890abcdef")?;
let secret = AppSecret::new("abc1234567890abcdef")?;
let client = WechatClient::builder()
.appid(appid)
.secret(secret)
.build()?;
Ok(())
}Implementations§
Source§impl WechatClientBuilder
impl WechatClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Set the base URL for API calls
Default: <https://api.weixin.qq.com>
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the total timeout for requests
Default: 30 seconds
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Set the connection timeout
Default: 10 seconds
Sourcepub fn build(self) -> Result<WechatClient, WechatError>
pub fn build(self) -> Result<WechatClient, WechatError>
Trait Implementations§
Source§impl Debug for WechatClientBuilder
impl Debug for WechatClientBuilder
Source§impl Default for WechatClientBuilder
impl Default for WechatClientBuilder
Source§fn default() -> WechatClientBuilder
fn default() -> WechatClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WechatClientBuilder
impl RefUnwindSafe for WechatClientBuilder
impl Send for WechatClientBuilder
impl Sync for WechatClientBuilder
impl Unpin for WechatClientBuilder
impl UnsafeUnpin for WechatClientBuilder
impl UnwindSafe for WechatClientBuilder
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