pub struct Client {Show 16 fields
pub cardkit: CardkitClient,
pub auth: AuthClient,
pub docs: DocsClient,
pub communication: CommunicationClient,
pub hr: HrClient,
pub meeting: MeetingClient,
pub ai: AiClient,
pub workflow: WorkflowService,
pub platform: PlatformService,
pub application: ApplicationService,
pub helpdesk: HelpdeskService,
pub mail: MailService,
pub analytics: AnalyticsService,
pub user: UserService,
pub security: SecurityClient,
pub bot: BotService,
/* 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.config()...
// - 认证:client.auth.app / client.auth.user / client.auth.oauth
Ok(())
}Fields§
§cardkit: CardkitClientCardKit meta 调用链:client.cardkit.v1.card.create(…)
auth: AuthClientAuth meta 调用链入口:client.auth.app / client.auth.user / client.auth.oauth
docs: DocsClientDocs meta 调用链入口:client.docs.config() / 各 async helper(如 search_bitable_records_all)…
communication: CommunicationClientCommunication meta 调用链入口:client.communication.im / client.communication.contact …
hr: HrClientHR meta 调用链入口:client.hr.attendance / client.hr.corehr / client.hr.hire …
meeting: MeetingClientMeeting meta 调用链入口:client.meeting.vc.v1.note.get(…) 等(ADR 0001:room/meeting/reserve 空壳已砍,真实 builder 经 strict 路径)
ai: AiClientAI meta 调用链入口:client.ai.chat.create() …
workflow: WorkflowServiceWorkflow meta 调用链入口:client.workflow.v2().task().create() …
platform: PlatformServicePlatform meta 调用链入口:client.platform.app_engine… …
application: ApplicationServiceApplication meta 调用链入口:client.application.applet… …
helpdesk: HelpdeskServiceHelpdesk meta 调用链入口:client.helpdesk.ticket… …
mail: MailServiceMail meta 调用链入口:client.mail.group… …
analytics: AnalyticsServiceAnalytics meta 调用链入口:client.analytics.report… …
user: UserServiceUser meta 调用链入口:client.user.system_status… …
security: SecurityClientSecurity meta 调用链入口:client.security.acs… …
bot: BotServiceBot meta 调用链入口:client.bot.search_bot() …
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 配置
与 Self::config 返回同一份配置。保留此别名是为了向后兼容。
Sourcepub fn api_config(&self) -> &Config
pub fn api_config(&self) -> &Config
🔧 获取可直接传给函数式 API 的认证后配置
与 Self::config 返回同一份配置。保留此别名是为了让
业务侧更容易理解它的用途:可直接传给 openlark_docs::*、
openlark_auth::* 等函数式 API。
Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
✅ 检查客户端是否已正确配置
Sourcepub fn with_core_config(config: Config) -> Result<Client, CoreError>
pub fn with_core_config(config: Config) -> Result<Client, CoreError>
🆕 使用统一 CoreConfig 创建客户端
与 ClientBuilder::build 共用私有构造 seam:Config::validate(含域名白名单)
- Client 零超时规则 + registry / token provider 装配。