Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
571 changes: 304 additions & 267 deletions .github/msrv/Cargo.lock

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/openlark-docs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ rstest = { workspace = true }
tempfile = { workspace = true }
mockall = { workspace = true }
insta = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }

[[example]]
name = "docs_readme_examples"
Expand Down
17 changes: 4 additions & 13 deletions crates/openlark-docs/src/baike/lingo/v1/entity/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ impl CreateEntityRequest {
mod tests {
use super::*;
use crate::baike::lingo::v1::models::{DisplayStatus, Term, UserIdType};
use crate::common::test_utils::tenant_test_transport;
use serde_json::json;
use wiremock::matchers::{header, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, ResponseTemplate};

#[test]
fn test_create_lingo_entity_request_builder() {
Expand Down Expand Up @@ -207,7 +208,7 @@ mod tests {

#[tokio::test]
async fn create_entity_uses_catalog_request_semantics() {
let server = MockServer::start().await;
let (server, config, option) = tenant_test_transport().await;
Mock::given(method("POST"))
.and(path("/open-apis/lingo/v1/entities"))
.and(header("Authorization", "Bearer test-tenant-token"))
Expand All @@ -219,12 +220,6 @@ mod tests {
.mount(&server)
.await;

let config = Config::builder()
.app_id("ci_app_id")
.app_secret("ci_app_secret")
.base_url(server.uri())
.enable_token_cache(false)
.build();
let body = EntityInput {
main_keys: vec![Term {
key: "测试词条".to_string(),
Expand All @@ -240,11 +235,7 @@ mod tests {
let response = CreateEntityRequest::new(config, body)
.repo_id("repo_123")
.user_id_type(UserIdType::OpenId)
.execute_with_options(
RequestOption::builder()
.tenant_access_token("test-tenant-token")
.build(),
)
.execute_with_options(option)
.await
.expect("创建词条应成功");
assert!(response.entity.is_none());
Expand Down
3 changes: 1 addition & 2 deletions crates/openlark-docs/src/base/base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ pub mod v2;
// 使用通配符导出所有子模块,避免维护大量重复的导出列表
// v2 模块显式导出
pub use v2::{
AppRole, Create, CreateReq, CreateResp, Delete, DeleteResp, List, ListReq, ListResp, Update,
UpdateReq, UpdateResp,
AppRole, Create, CreateReq, CreateResp, List, ListReq, ListResp, Update, UpdateReq, UpdateResp,
};
145 changes: 0 additions & 145 deletions crates/openlark-docs/src/base/base/v2/app/role/delete.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/openlark-docs/src/base/base/v2/app/role/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pub mod create;
pub mod delete;
pub mod list;
pub mod update;

pub use create::{Create, CreateReq, CreateResp};
pub use delete::{Delete, DeleteResp};
pub use list::{List, ListReq, ListResp};
pub use update::{Update, UpdateReq, UpdateResp};
15 changes: 2 additions & 13 deletions crates/openlark-docs/src/ccm/drive/v1/file/create_folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ mod tests {
/// 端到端:使用 catalog 语义,POST /open-apis/drive/v1/files/create_folder ,断言 method/path/auth。
#[tokio::test]
async fn test_create_folder_returns_data_on_success_440() {
use crate::common::test_utils::tenant_test_transport;
use serde_json::json;
use wiremock::MockServer;
use wiremock::matchers::{header, method, path};
use wiremock::{Mock, ResponseTemplate};

let server = MockServer::start().await;
let (server, config, option) = tenant_test_transport().await;
Mock::given(method("POST"))
.and(path("/open-apis/drive/v1/files/create_folder"))
.and(header("Authorization", "Bearer test-tenant-token"))
Expand All @@ -201,17 +201,6 @@ mod tests {
.mount(&server)
.await;

let config = Config::builder()
.app_id("ci_app_id")
.app_secret("ci_app_secret")
.base_url(server.uri())
.enable_token_cache(false)
.build();

let option = openlark_core::req_option::RequestOption::builder()
.tenant_access_token("test-tenant-token")
.build();

let resp = CreateFolderRequest::new(config, "测试文件夹", "parent_token_001")
.execute_with_options(option)
.await
Expand Down
15 changes: 3 additions & 12 deletions crates/openlark-docs/src/ccm/explorer/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,14 @@ pub use models::{
#[cfg(test)]
mod tests {
use super::*;
use crate::common::test_utils::tenant_test_transport;
use serde_json::json;
use wiremock::matchers::{header, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, ResponseTemplate};

#[tokio::test]
async fn get_root_folder_meta_uses_catalog_request_semantics() {
let server = MockServer::start().await;
let (server, config, option) = tenant_test_transport().await;
Mock::given(method("GET"))
.and(path("/open-apis/drive/explorer/v2/root_folder/meta"))
.and(header("Authorization", "Bearer test-tenant-token"))
Expand All @@ -476,16 +477,6 @@ mod tests {
.mount(&server)
.await;

let config = Config::builder()
.app_id("ci_app_id")
.app_secret("ci_app_secret")
.base_url(server.uri())
.enable_token_cache(false)
.build();
let option = RequestOption::builder()
.tenant_access_token("test-tenant-token")
.build();

let response = GetRootFolderMetaRequest::new(config)
.execute_with_options(option)
.await
Expand Down
14 changes: 3 additions & 11 deletions crates/openlark-docs/src/ccm/permission/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,14 @@ pub use models::{
#[cfg(test)]
mod tests {
use super::*;
use crate::common::test_utils::tenant_test_transport;
use serde_json::json;
use wiremock::matchers::{header, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, ResponseTemplate};

#[tokio::test]
async fn check_member_permission_uses_catalog_request_semantics() {
let server = MockServer::start().await;
let (server, config, option) = tenant_test_transport().await;
Mock::given(method("POST"))
.and(path("/open-apis/drive/v1/permission/member/permitted"))
.and(header("Authorization", "Bearer test-tenant-token"))
Expand All @@ -183,15 +184,6 @@ mod tests {
.mount(&server)
.await;

let config = Config::builder()
.app_id("ci_app_id")
.app_secret("ci_app_secret")
.base_url(server.uri())
.enable_token_cache(false)
.build();
let option = RequestOption::builder()
.tenant_access_token("test-tenant-token")
.build();
let params = CheckMemberPermissionParams {
obj_token: "doc_token".to_string(),
permission: "view".to_string(),
Expand Down
Loading
Loading