pub struct WecomClientBuilder { /* private fields */ }Expand description
Implementations§
Source§impl WecomClientBuilder
impl WecomClientBuilder
Sourcepub fn token_provider(self, provider: Arc<dyn TokenProvider>) -> Self
pub fn token_provider(self, provider: Arc<dyn TokenProvider>) -> Self
设置 token provider(token 注入与 853004 静默刷新的来源)。
Sourcepub fn initial_token(self, token: impl Into<String>) -> Self
pub fn initial_token(self, token: impl Into<String>) -> Self
预置初始 token(缺省时经 provider 读取;如 CLI 的环境变量覆写)。
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
添加默认请求头(对每个请求生效;header 名/值在 build 时统一校验)。
Sourcepub async fn build(self) -> Result<WecomClient, Error>
pub async fn build(self) -> Result<WecomClient, Error>
Build the authenticated WecomClient.
等价于 build_transport 之后经
WecomClient::from_transport
组装完整客户端(自动挂网关协议端点目录,直接可调服务方法)。
§Errors
底层传输配置非法(header 校验等)或客户端构建失败时返回
wecomx::Error。
Sourcepub async fn build_transport(self) -> Result<Transport, Error>
pub async fn build_transport(self) -> Result<Transport, Error>
Build only the authenticated Transport(不组装客户端)。
适合需要完全掌控 wecomx::Client 配置(沙箱 FS、helper、扩展命令、
端点目录覆写等)的调用方。
初始 token 优先取 initial_token,否则经
provider 读取(无凭据为 None,不报错);transport 装饰为
WecomBackend(动态注入 + 门禁 + 853004 静默刷新)。
§Errors
底层传输配置非法(header 校验等)或初始 token 读取失败时返回
wecomx_transport::Error。
Trait Implementations§
Source§impl Clone for WecomClientBuilder
impl Clone for WecomClientBuilder
Source§fn clone(&self) -> WecomClientBuilder
fn clone(&self) -> WecomClientBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WecomClientBuilder
impl !UnwindSafe for WecomClientBuilder
impl Freeze for WecomClientBuilder
impl Send for WecomClientBuilder
impl Sync for WecomClientBuilder
impl Unpin for WecomClientBuilder
impl UnsafeUnpin for WecomClientBuilder
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