pub struct ClientBuilder { /* private fields */ }Expand description
🏗️ 客户端构建器 - 流畅API
提供链式调用的客户端构建方式
§示例
use openlark_client::Client;
use openlark_client::Result;
use std::time::Duration;
fn main() -> Result<()> {
let _client = Client::builder()
.app_id("your_app_id")
.app_secret("your_app_secret")
.base_url("https://open.feishu.cn")
.timeout(Duration::from_secs(30))
.build()?;
Ok(())
}Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn app_secret<S: Into<String>>(self, app_secret: S) -> Self
pub fn app_secret<S: Into<String>>(self, app_secret: S) -> Self
🔑 设置应用密钥
Sourcepub fn enable_token_cache(self, enable: bool) -> Self
pub fn enable_token_cache(self, enable: bool) -> Self
🔐 设置是否允许自动获取 token(默认 true)
Sourcepub fn retry_count(self, retry_count: u32) -> Self
pub fn retry_count(self, retry_count: u32) -> Self
🔄 设置重试次数
Sourcepub fn enable_log(self, enable: bool) -> Self
pub fn enable_log(self, enable: bool) -> Self
📝 启用或禁用日志
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more