Skip to main content

Crate openlark_core

Crate openlark_core 

Source
Expand description

OpenLark Core Infrastructure

This crate provides the core infrastructure for the OpenLark SDK including HTTP client configuration, error handling, authentication, and common utilities.

Re-exports§

pub use error::validation_error;
pub use error::CoreError;
pub use error::SDKResult;
pub use validation::Validatable;

Modules§

api
API处理模块 - 独立版本
auth
认证管理模块
config
客户端配置模块(Config、ConfigBuilder 等)
constants
全局常量定义(URL、错误码前缀、超时配置等)
error
统一错误处理模块(CoreError、错误码、错误上下文等) 现代化错误处理系统
http
HTTP 客户端模块(Transport、请求构建等)
prelude
Prelude module for convenient imports.
req_option
请求选项模块(RequestOption、自定义头部、租户键等)
testing
现代化测试基础设施模块
trait_system
Trait System
validation
API验证模块

Macros§

api_err
创建API错误的宏
assert_err_contains
断言 Result 为 Err,且错误消息包含指定文本
assert_none
断言 Option 为 None
assert_res_err
断言 Result 为 Err,匹配错误模式并返回错误
assert_res_ok
断言 Result 为 Ok,返回值
assert_some
断言 Option 为 Some,返回值
auth_err
创建认证错误的宏
business_err
创建业务错误的宏
ensure
条件错误返回宏(现代化版本)
handle_error
错误匹配和处理宏
impl_api_response
使用宏简化APIResponseTrait实现
network_err
创建网络错误的宏
validate
快速验证宏
validate_required
验证必填字段(检查非空白字符串)
validate_required_list
验证必填列表字段(检查非空和最大长度)
validation_err
创建验证错误的宏