pub struct Client {Show 15 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,
/* 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§
§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.ccm / client.docs.base …
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.room.create() …
ai: AiClientAI meta 调用链入口:client.ai.chat.create() …
workflow: WorkflowServiceWorkflow meta 调用链入口:client.workflow.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.setting… …
security: SecurityClientSecurity meta 调用链入口:client.security.acs… …
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
✅ 检查客户端是否已正确配置
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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request