Skip to main content

open_lark/
lib.rs

1//! OpenLark 官方入口 crate。
2//!
3//! 普通用户应优先使用 `openlark`,通过业务 feature 开启所需能力:
4//!
5//! ```toml
6//! [dependencies]
7//! openlark = { version = "0.15.0", default-features = false, features = ["auth", "docs-drive", "docs-bitable", "webhook-signature"] }
8//! ```
9//!
10//! - 统一客户端入口:[`Client`]
11//! - 高级业务模块入口:[`auth`]、[`communication`]、[`docs`]、[`workflow`] 等
12//! - 统一预导出:[`prelude`]
13//!
14//! 若只想要单一业务域的最小依赖,再直接使用 `openlark-{domain}` 子 crate。
15
16// 允许测试模块中的未使用导入(测试桩代码常见模式)
17#![allow(unused_imports)]
18
19pub use openlark_client;
20pub use openlark_client::{Client, ClientBuilder, Config, Error, Result};
21pub use openlark_core;
22pub use openlark_core as core;
23pub use openlark_core::config::Config as CoreConfig;
24pub use openlark_core::error::{CoreError, ErrorCode, ErrorSeverity, ErrorTrait, ErrorType};
25pub use openlark_core::req_option::RequestOption;
26pub use openlark_core::SDKResult;
27
28#[cfg(feature = "websocket")]
29/// WebSocket 客户端相关类型导出。
30pub mod ws_client {
31    pub use openlark_client::ws_client::*;
32}
33
34#[cfg(feature = "auth")]
35pub use openlark_auth;
36
37#[cfg(feature = "auth")]
38pub use openlark_auth as auth;
39
40#[cfg(feature = "communication")]
41pub use openlark_communication;
42
43#[cfg(feature = "communication")]
44pub use openlark_communication as communication;
45
46#[cfg(any(
47    feature = "docs",
48    feature = "docs-ccm",
49    feature = "docs-base",
50    feature = "docs-bitable",
51    feature = "docs-drive",
52    feature = "docs-explorer",
53    feature = "docs-sheets",
54    feature = "docs-sheets-v2",
55    feature = "docs-sheets-v3",
56    feature = "docs-full"
57))]
58pub use openlark_docs;
59
60#[cfg(any(
61    feature = "docs",
62    feature = "docs-ccm",
63    feature = "docs-base",
64    feature = "docs-bitable",
65    feature = "docs-drive",
66    feature = "docs-explorer",
67    feature = "docs-sheets",
68    feature = "docs-sheets-v2",
69    feature = "docs-sheets-v3",
70    feature = "docs-full"
71))]
72pub use openlark_docs as docs;
73
74#[cfg(feature = "hr")]
75pub use openlark_hr as hr;
76
77#[cfg(feature = "ai")]
78pub use openlark_ai as ai;
79
80#[cfg(feature = "helpdesk")]
81pub use openlark_helpdesk as helpdesk;
82
83#[cfg(feature = "mail")]
84pub use openlark_mail as mail;
85
86#[cfg(feature = "meeting")]
87pub use openlark_meeting as meeting;
88
89#[cfg(feature = "application")]
90pub use openlark_application as application;
91
92#[cfg(feature = "security")]
93pub use openlark_security as security;
94
95#[cfg(feature = "workflow")]
96pub use openlark_workflow as workflow;
97
98#[cfg(feature = "platform")]
99pub use openlark_platform as platform;
100
101#[cfg(feature = "analytics")]
102pub use openlark_analytics as analytics;
103
104#[cfg(feature = "user")]
105pub use openlark_user as user;
106
107#[cfg(feature = "webhook")]
108pub use openlark_webhook;
109
110#[cfg(feature = "webhook")]
111pub use openlark_webhook as webhook;
112
113#[cfg(feature = "cardkit")]
114pub use openlark_cardkit as cardkit;
115
116#[cfg(feature = "auth")]
117pub use openlark_client::AuthClient;
118
119#[cfg(any(
120    feature = "docs",
121    feature = "docs-ccm",
122    feature = "docs-base",
123    feature = "docs-bitable",
124    feature = "docs-drive",
125    feature = "docs-explorer",
126    feature = "docs-sheets",
127    feature = "docs-sheets-v2",
128    feature = "docs-sheets-v3",
129    feature = "docs-full"
130))]
131pub use openlark_client::DocsClient;
132
133#[cfg(feature = "communication")]
134pub use openlark_client::CommunicationClient;
135
136#[cfg(feature = "hr")]
137pub use openlark_client::HrClient;
138
139#[cfg(feature = "meeting")]
140pub use openlark_client::MeetingClient;
141
142#[cfg(feature = "cardkit")]
143pub use openlark_client::CardkitClient;
144
145/// 面向 `openlark` 用户的统一预导出。
146pub mod prelude {
147    #[cfg(feature = "auth")]
148    pub use crate::AuthClient;
149    #[cfg(feature = "communication")]
150    pub use crate::CommunicationClient;
151    #[cfg(any(
152        feature = "docs",
153        feature = "docs-ccm",
154        feature = "docs-base",
155        feature = "docs-bitable",
156        feature = "docs-drive",
157        feature = "docs-explorer",
158        feature = "docs-sheets",
159        feature = "docs-sheets-v2",
160        feature = "docs-sheets-v3",
161        feature = "docs-full"
162    ))]
163    pub use crate::DocsClient;
164    #[cfg(feature = "hr")]
165    pub use crate::HrClient;
166    #[cfg(feature = "meeting")]
167    pub use crate::MeetingClient;
168    pub use crate::SDKResult;
169    pub use crate::{Client, ClientBuilder, Config, CoreConfig, Error, Result};
170    pub use crate::{CoreError, ErrorCode, ErrorSeverity, ErrorTrait, ErrorType, RequestOption};
171    pub use openlark_core::prelude::*;
172}