pub struct Client {
pub auth: AuthClient,
/* private fields */
}Expand description
🚀 OpenLark客户端 - 极简设计
§特性
- 零配置启动:
Client::from_env() - 单入口:meta 链式字段访问(
client.docs/...) - 编译时feature优化
- 高性能异步
- 现代化错误处理
§示例
use openlark_client::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
// 从环境变量创建客户端
let client = Client::from_env()?;
// meta 链式入口(需要对应 feature)
// - 通讯:client.communication.im...
// - 文档:client.docs.ccm...
// - 认证:client.auth.app / client.auth.user / client.auth.oauth
Ok(())
}Fields§
§auth: AuthClientAuth meta 调用链入口:client.auth.app / client.auth.user / client.auth.oauth
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
🏗️ 创建构建器
Sourcepub fn registry(&self) -> &DefaultServiceRegistry
pub fn registry(&self) -> &DefaultServiceRegistry
📋 获取服务注册表
Sourcepub fn core_config(&self) -> &Config
pub fn core_config(&self) -> &Config
🔧 获取底层 core 配置(高级用法/调试用)
Sourcepub fn api_config(&self) -> &Config
pub fn api_config(&self) -> &Config
🔧 获取可直接传给函数式 API 的认证后配置
与 Self::core_config 返回同一份配置,保留这个别名是为了让
业务侧更容易理解它的用途:可直接传给 openlark_docs::*、
openlark_auth::* 等函数式 API。
Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
✅ 检查客户端是否已正确配置
Trait Implementations§
Source§impl ClientErrorHandling for Client
impl ClientErrorHandling for Client
Source§impl LarkClient for Client
impl LarkClient for Client
Source§fn is_configured(&self) -> bool
fn is_configured(&self) -> bool
✅ 检查客户端是否已正确配置 Read more
Source§fn app_secret(&self) -> &str
fn app_secret(&self) -> &str
🔑 获取应用密钥
Source§fn retry_count(&self) -> u32
fn retry_count(&self) -> u32
🔄 获取重试次数
Source§fn is_log_enabled(&self) -> bool
fn is_log_enabled(&self) -> bool
📝 检查是否启用了日志
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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