-
Notifications
You must be signed in to change notification settings - Fork 22
fix: Align Cargo features with cfg gates across all crates #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c45f42f
0bea99a
7b2794e
19a0a27
9b70cec
8faf314
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,7 @@ impl AuthClient { | |
| /// Ok(()) | ||
| /// } | ||
| /// ``` | ||
| #[derive(Debug, Clone)] | ||
| #[derive(Clone)] | ||
| pub struct Client { | ||
| /// 客户端配置 | ||
| config: Arc<Config>, | ||
|
|
@@ -91,6 +91,67 @@ pub struct Client { | |
| /// Meeting meta 调用链入口:client.meeting.vc.v1.room.create() ... | ||
| #[cfg(feature = "meeting")] | ||
| pub meeting: openlark_meeting::MeetingClient, | ||
|
|
||
| /// AI meta 调用链入口:client.ai.chat.create() ... | ||
| #[cfg(feature = "ai")] | ||
| pub ai: openlark_ai::AiClient, | ||
|
|
||
| /// Workflow meta 调用链入口:client.workflow.task.create() ... | ||
| #[cfg(feature = "workflow")] | ||
| pub workflow: crate::WorkflowClient, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
|
|
||
| /// Platform meta 调用链入口:client.platform.app_engine... ... | ||
| #[cfg(feature = "platform")] | ||
| pub platform: crate::PlatformClient, | ||
|
|
||
| /// Application meta 调用链入口:client.application.applet... ... | ||
| #[cfg(feature = "application")] | ||
| pub application: crate::ApplicationClient, | ||
|
|
||
| /// Helpdesk meta 调用链入口:client.helpdesk.ticket... ... | ||
| #[cfg(feature = "helpdesk")] | ||
| pub helpdesk: crate::HelpdeskClient, | ||
|
|
||
| /// Mail meta 调用链入口:client.mail.group... ... | ||
| #[cfg(feature = "mail")] | ||
| pub mail: crate::MailClient, | ||
|
|
||
| /// Analytics meta 调用链入口:client.analytics.report... ... | ||
| #[cfg(feature = "analytics")] | ||
| pub analytics: crate::AnalyticsClient, | ||
|
|
||
| /// User meta 调用链入口:client.user.setting... ... | ||
| #[cfg(feature = "user")] | ||
| pub user: crate::UserClient, | ||
|
|
||
| /// Security meta 调用链入口:client.security.acs... ... | ||
| #[cfg(feature = "security")] | ||
| pub security: crate::SecurityClient, | ||
| } | ||
|
|
||
| impl std::fmt::Debug for Client { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| f.debug_struct("Client") | ||
| .field("config", &"<Config>") | ||
| .field("registry", &"<Registry>") | ||
| .field("core_config", &"<CoreConfig>") | ||
| .field("cardkit", &cfg!(feature = "cardkit")) | ||
| .field("auth", &cfg!(feature = "auth")) | ||
| .field("docs", &cfg!(feature = "docs")) | ||
| .field("communication", &cfg!(feature = "communication")) | ||
| .field("hr", &cfg!(feature = "hr")) | ||
| .field("meeting", &cfg!(feature = "meeting")) | ||
| .field("ai", &cfg!(feature = "ai")) | ||
| .field("workflow", &cfg!(feature = "workflow")) | ||
| .field("platform", &cfg!(feature = "platform")) | ||
| .field("application", &cfg!(feature = "application")) | ||
| .field("helpdesk", &cfg!(feature = "helpdesk")) | ||
| .field("mail", &cfg!(feature = "mail")) | ||
| .field("analytics", &cfg!(feature = "analytics")) | ||
| .field("user", &cfg!(feature = "user")) | ||
| .field("security", &cfg!(feature = "security")) | ||
| .finish() | ||
| } | ||
| } | ||
|
|
||
| impl Client { | ||
|
|
@@ -103,6 +164,7 @@ impl Client { | |
| /// export OPENLARK_BASE_URL=https://open.feishu.cn # 可选 | ||
| /// ``` | ||
| /// | ||
| /// | ||
| /// # 返回值 | ||
| /// 返回配置好的客户端实例或错误 | ||
| /// | ||
|
|
@@ -195,6 +257,40 @@ impl Client { | |
| #[cfg(feature = "meeting")] | ||
| let meeting = openlark_meeting::MeetingClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "ai")] | ||
| let ai = openlark_ai::AiClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "workflow")] | ||
| let workflow = crate::WorkflowClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "platform")] | ||
| let platform = crate::PlatformClient::new(core_config.clone())?; | ||
|
|
||
| #[cfg(feature = "application")] | ||
| let application = crate::ApplicationClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "helpdesk")] | ||
| let helpdesk = crate::HelpdeskClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "mail")] | ||
| let mail = crate::MailClient::new(core_config.clone()); | ||
|
|
||
| #[cfg(feature = "analytics")] | ||
| let analytics = crate::AnalyticsClient::new(core_config.clone())?; | ||
|
|
||
| #[cfg(feature = "user")] | ||
| let user = crate::UserClient::new(core_config.clone())?; | ||
|
|
||
| #[cfg(feature = "security")] | ||
| let security = { | ||
| let security_config = openlark_security::models::SecurityConfig::new( | ||
| config.app_id.clone(), | ||
| config.app_secret.clone(), | ||
| ) | ||
| .with_base_url(&config.base_url); | ||
| std::sync::Arc::new(openlark_security::SecurityServices::new(security_config)) | ||
| }; | ||
|
|
||
| Ok(Client { | ||
| config, | ||
| registry, | ||
|
|
@@ -211,6 +307,24 @@ impl Client { | |
| hr, | ||
| #[cfg(feature = "meeting")] | ||
| meeting, | ||
| #[cfg(feature = "ai")] | ||
| ai, | ||
| #[cfg(feature = "workflow")] | ||
| workflow, | ||
| #[cfg(feature = "platform")] | ||
| platform, | ||
| #[cfg(feature = "application")] | ||
| application, | ||
| #[cfg(feature = "helpdesk")] | ||
| helpdesk, | ||
| #[cfg(feature = "mail")] | ||
| mail, | ||
| #[cfg(feature = "analytics")] | ||
| analytics, | ||
| #[cfg(feature = "user")] | ||
| user, | ||
| #[cfg(feature = "security")] | ||
| security, | ||
| }) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly added
workflow/application/helpdesk/mailfields use service alias types that do not implementDebug, butClientstill derivesDebug. Enabling any of those features triggersE0277and prevents compilation, so these fields should not introduce non-Debugmembers into aDebug-derived struct without an adaptation.Useful? React with 👍 / 👎.