pub struct WecomClient { /* private fields */ }Expand description
WeCom 客户端:认证、服务发现与方法调用的统一入口。
经 WecomClientBuilder 构建后即可直接使用:
ⓘ
let client = WecomClientBuilder::new()
.token_provider(Arc::new(provider))
.build()
.await?;
// 程序化调用(服务/方法名由 discovery 下发)
let svc = client.service("hr").await?;
let result = svc.method(&["users", "list"])?.invoke(json!({})).await?;Implementations§
Source§impl WecomClient
impl WecomClient
Sourcepub fn from_transport(transport: Transport) -> Result<Self, Error>
pub fn from_transport(transport: Transport) -> Result<Self, Error>
用已构建的 transport 组装客户端(自动挂网关协议端点目录)。
适合需要完全自定义 transport 的调用方;常规路径请用
WecomClientBuilder。
§Errors
wecomx::Client 构建失败时返回 wecomx::Error。
Sourcepub fn from_client(inner: Client) -> Self
pub fn from_client(inner: Client) -> Self
包裹一个已配置好的 wecomx::Client(不改动其任何配置)。
Sourcepub fn inner(&self) -> &Client
pub fn inner(&self) -> &Client
底层 wecomx::Client(需要沙箱 FS、helper、扩展命令等高级配置时使用)。
Sourcepub fn into_inner(self) -> Client
pub fn into_inner(self) -> Client
消耗自身,返回底层 wecomx::Client。
Sourcepub async fn list_services(&self) -> Result<Vec<ServiceInfo>, Error>
pub async fn list_services(&self) -> Result<Vec<ServiceInfo>, Error>
Auto Trait Implementations§
impl !Freeze for WecomClient
impl !RefUnwindSafe for WecomClient
impl !UnwindSafe for WecomClient
impl Send for WecomClient
impl Sync for WecomClient
impl Unpin for WecomClient
impl UnsafeUnpin for WecomClient
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