From 66f3170c2dce654b4ffa7166c43f1efe859ee346 Mon Sep 17 00:00:00 2001 From: ZoOL Date: Fri, 10 Jul 2026 12:01:51 +0800 Subject: [PATCH] fix(helpdesk): remove faq_image orphan and notification list phantom (#380) Delete the unused faq_image duplicate of faq/image, and remove the catalog-missing notification list API (endpoint enum, accessor, re-exports). Breaking: no migration path for the phantom list surface. --- CHANGELOG.md | 8 ++ .../src/common/api_endpoints.rs | 4 - .../src/helpdesk/helpdesk/v1/faq/faq_image.rs | 134 ------------------ .../src/helpdesk/helpdesk/v1/faq/mod.rs | 2 - .../helpdesk/helpdesk/v1/notification/list.rs | 125 ---------------- .../helpdesk/helpdesk/v1/notification/mod.rs | 8 -- 6 files changed, 8 insertions(+), 273 deletions(-) delete mode 100644 crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/faq_image.rs delete mode 100644 crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/list.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index fac1e609a..93c4da510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking +- **删除 `openlark-helpdesk` 幻影/孤儿 API(#380)**:#351 helpdesk e2e catalog 核对发现 + (1) `faq/faq_image` 与 `faq/image` 生产代码完全重复且从未 re-export/挂到 `Faq`——删除孤儿 + `faq_image` 模块,保留 `image`(含 wiremock e2e);(2) `notification/list` + (`GET /open-apis/helpdesk/v1/notifications`,`HelpdeskApiV1::NotificationList`)不在 + `api_list_export.csv` 的 8 个 notification 端点中,官方文档亦无 list——删除 list 源文件、 + `Notification::list()`、公开 re-export 与 endpoint 变体。**无迁移路径**:list 对真实飞书 + 无 catalog/文档支撑;FAQ 图片请继续用 `Faq::image()`。 + - **删除 `openlark-application` 幻影/残破 stub(#382)**:#351 e2e 化对照 `api_list_export.csv` 发现约 56 个从未可用的 stub——path 多一层 (`/open-apis/application/application/...`)、create/delete/patch 滥用 GET、 diff --git a/crates/openlark-helpdesk/src/common/api_endpoints.rs b/crates/openlark-helpdesk/src/common/api_endpoints.rs index 528205577..61ab428c6 100644 --- a/crates/openlark-helpdesk/src/common/api_endpoints.rs +++ b/crates/openlark-helpdesk/src/common/api_endpoints.rs @@ -64,8 +64,6 @@ pub enum HelpdeskApiV1 { /// FAQ 图片端点。 FaqImage(String, String), // Notification APIs - /// 通知列表端点。 - NotificationList, /// 获取通知端点。 NotificationGet(String), /// 创建通知端点。 @@ -177,7 +175,6 @@ impl HelpdeskApiV1 { format!("/open-apis/helpdesk/v1/faqs/{id}/image/{image_key}") } // Notification APIs - HelpdeskApiV1::NotificationList => "/open-apis/helpdesk/v1/notifications".to_string(), HelpdeskApiV1::NotificationGet(id) => { format!("/open-apis/helpdesk/v1/notifications/{id}") } @@ -280,7 +277,6 @@ mod tests { HelpdeskApiV1::FaqDelete("id1".to_string()).to_url(), HelpdeskApiV1::FaqSearch.to_url(), HelpdeskApiV1::FaqImage("id1".to_string(), "id2".to_string()).to_url(), - HelpdeskApiV1::NotificationList.to_url(), HelpdeskApiV1::NotificationGet("id1".to_string()).to_url(), HelpdeskApiV1::NotificationCreate.to_url(), HelpdeskApiV1::NotificationPatch("id1".to_string()).to_url(), diff --git a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/faq_image.rs b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/faq_image.rs deleted file mode 100644 index d7b65f2bd..000000000 --- a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/faq_image.rs +++ /dev/null @@ -1,134 +0,0 @@ -//! 获取知识库图片 -//! -//! 获取知识库的图片。 -//! -//! docPath: - -use openlark_core::{ - SDKResult, - api::{ApiRequest, ApiResponseTrait, ResponseFormat}, - config::Config, - http::Transport, -}; -use serde::{Deserialize, Serialize}; -use std::sync::Arc; - -use crate::common::api_endpoints::HelpdeskApiV1; -use crate::common::api_utils::extract_response_data; - -/// 获取知识库图片响应 -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct GetFaqImageResponse { - /// 图片Key - #[serde(skip_serializing_if = "Option::is_none")] - pub image_key: Option, - /// 图片URL - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, -} - -impl ApiResponseTrait for GetFaqImageResponse { - fn data_format() -> ResponseFormat { - ResponseFormat::Data - } -} - -/// 获取知识库图片请求 -#[derive(Debug, Clone)] -pub struct GetFaqImageRequest { - config: Arc, - id: String, - image_key: String, -} - -impl GetFaqImageRequest { - /// 创建新的获取知识库图片请求 - pub fn new(config: Arc, id: String, image_key: String) -> Self { - Self { - config, - id, - image_key, - } - } - - /// 执行获取知识库图片请求 - pub async fn execute(self) -> SDKResult { - self.execute_with_options(openlark_core::req_option::RequestOption::default()) - .await - } - - /// 使用选项执行请求 - pub async fn execute_with_options( - self, - option: openlark_core::req_option::RequestOption, - ) -> SDKResult { - let api_endpoint = HelpdeskApiV1::FaqImage(self.id.clone(), self.image_key.clone()); - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, &self.config, Some(option)).await?; - extract_response_data(response, "获取知识库图片") - } -} - -/// 获取知识库图片请求构建器 -#[derive(Debug, Clone)] -pub struct GetFaqImageRequestBuilder { - config: Arc, - id: String, - image_key: String, -} - -impl GetFaqImageRequestBuilder { - /// 创建新的构建器 - pub fn new(config: Arc, id: String, image_key: String) -> Self { - Self { - config, - id, - image_key, - } - } - - /// 执行请求 - pub async fn execute(&self) -> SDKResult { - let api_endpoint = HelpdeskApiV1::FaqImage(self.id.clone(), self.image_key.clone()); - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, &self.config, None).await?; - extract_response_data(response, "获取知识库图片") - } -} - -/// 执行获取知识库图片 -pub async fn get_faq_image( - config: &Config, - id: String, - image_key: String, -) -> SDKResult { - let api_endpoint = HelpdeskApiV1::FaqImage(id, image_key); - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, config, None).await?; - extract_response_data(response, "获取知识库图片") -} - -#[cfg(test)] -#[allow(unused_imports)] -mod tests { - use super::*; - - #[test] - fn test_builder_creation() { - let config = Config::builder() - .app_id("test_app_id") - .app_secret("test_app_secret") - .build(); - let builder = GetFaqImageRequestBuilder::new( - Arc::new(config), - "faq_123".to_string(), - "image_key_456".to_string(), - ); - - assert_eq!(builder.id, "faq_123"); - assert_eq!(builder.image_key, "image_key_456"); - } -} diff --git a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/mod.rs b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/mod.rs index a560cde6a..2e41da94b 100644 --- a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/mod.rs +++ b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/faq/mod.rs @@ -5,8 +5,6 @@ pub mod create; /// 删除接口。 pub mod delete; -/// faq_image 模块。 -pub mod faq_image; /// 获取接口。 pub mod get; /// image 模块。 diff --git a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/list.rs b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/list.rs deleted file mode 100644 index 09b6b3d3b..000000000 --- a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/list.rs +++ /dev/null @@ -1,125 +0,0 @@ -//! 获取推送通知列表 -//! -//! 获取推送通知列表。 -//! -//! docPath: - -use openlark_core::{ - SDKResult, - api::{ApiRequest, ApiResponseTrait, ResponseFormat}, - config::Config, - http::Transport, -}; -use serde::{Deserialize, Serialize}; -use std::sync::Arc; - -use crate::common::api_endpoints::HelpdeskApiV1; -use crate::common::api_utils::extract_response_data; - -/// 获取推送通知列表响应 -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ListNotificationResponse { - /// 推送通知列表 - #[serde(skip_serializing_if = "Option::is_none")] - pub items: Option>, -} - -impl ApiResponseTrait for ListNotificationResponse { - fn data_format() -> ResponseFormat { - ResponseFormat::Data - } -} - -/// 推送通知项 -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct NotificationItem { - /// 推送ID - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// 标题 - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// 状态 - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// 创建时间 - #[serde(skip_serializing_if = "Option::is_none")] - pub created_at: Option, -} - -/// 获取推送通知列表请求 -#[derive(Debug, Clone)] -pub struct ListNotificationRequest { - config: Arc, -} - -impl ListNotificationRequest { - /// 创建新的获取推送通知列表请求 - pub fn new(config: Arc) -> Self { - Self { config } - } - - /// 执行获取推送通知列表请求 - pub async fn execute(self) -> SDKResult { - self.execute_with_options(openlark_core::req_option::RequestOption::default()) - .await - } - - /// 使用选项执行请求 - pub async fn execute_with_options( - self, - option: openlark_core::req_option::RequestOption, - ) -> SDKResult { - let api_endpoint = HelpdeskApiV1::NotificationList; - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, &self.config, Some(option)).await?; - extract_response_data(response, "获取推送通知列表") - } -} - -/// 获取推送通知列表请求构建器 -#[derive(Debug, Clone)] -pub struct ListNotificationRequestBuilder { - config: Arc, -} - -impl ListNotificationRequestBuilder { - /// 创建新的构建器 - pub fn new(config: Arc) -> Self { - Self { config } - } - - /// 执行请求 - pub async fn execute(&self) -> SDKResult { - let api_endpoint = HelpdeskApiV1::NotificationList; - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, &self.config, None).await?; - extract_response_data(response, "获取推送通知列表") - } -} - -/// 执行获取推送通知列表 -pub async fn list_notifications(config: &Config) -> SDKResult { - let api_endpoint = HelpdeskApiV1::NotificationList; - let request = ApiRequest::::get(api_endpoint.to_url()); - - let response = Transport::request(request, config, None).await?; - extract_response_data(response, "获取推送通知列表") -} - -#[cfg(test)] -#[allow(unused_imports)] -mod tests { - use super::*; - - #[test] - fn test_builder_creation() { - let config = Config::builder() - .app_id("test_app_id") - .app_secret("test_app_secret") - .build(); - let _builder = ListNotificationRequestBuilder::new(Arc::new(config)); - } -} diff --git a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/mod.rs b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/mod.rs index 320a6f54a..39b164ac3 100644 --- a/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/mod.rs +++ b/crates/openlark-helpdesk/src/helpdesk/helpdesk/v1/notification/mod.rs @@ -11,8 +11,6 @@ pub mod create; pub mod execute_send; /// 获取接口。 pub mod get; -/// 列表接口。 -pub mod list; /// 更新接口。 pub mod patch; /// preview 模块。 @@ -35,11 +33,6 @@ impl Notification { Self { config } } - /// 获取推送通知列表 - pub fn list(&self) -> list::ListNotificationRequest { - list::ListNotificationRequest::new(self.config.clone()) - } - /// 创建推送通知 pub fn create(&self) -> create::CreateNotificationRequest { create::CreateNotificationRequest::new(self.config.clone()) @@ -112,7 +105,6 @@ pub use cancel_send::{CancelSendNotificationRequest, CancelSendNotificationReque pub use create::{CreateNotificationRequest, CreateNotificationRequestBuilder}; pub use execute_send::{ExecuteSendNotificationRequest, ExecuteSendNotificationRequestBuilder}; pub use get::{GetNotificationRequest, GetNotificationRequestBuilder}; -pub use list::{ListNotificationRequest, ListNotificationRequestBuilder}; pub use patch::{PatchNotificationRequest, PatchNotificationRequestBuilder}; pub use preview::{PreviewNotificationRequest, PreviewNotificationRequestBuilder}; pub use submit_approve::{