Struct LarkClientBuilder

Source
pub struct LarkClientBuilder { /* private fields */ }
Expand description

飞书客户端构建器

使用构建器模式配置和创建LarkClient实例。支持链式调用配置各种选项。

§示例

use open_lark::prelude::*;

let client = LarkClient::builder("app_id", "app_secret")
    .with_app_type(AppType::SelfBuild)
    .with_enable_token_cache(true)
    .with_req_timeout(Some(30.0))
    .build();

Implementations§

Source§

impl LarkClientBuilder

Source

pub fn with_app_type(self, app_type: AppType) -> Self

设置应用类型

§参数
  • app_type: 应用类型,AppType::SelfBuild(自建应用)或AppType::Marketplace(商店应用)
Source

pub fn with_marketplace_app(self) -> Self

设置为商店应用(等同于 with_app_type(AppType::Marketplace)

Source

pub fn with_open_base_url(self, base_url: String) -> Self

设置自定义API基础URL

§参数
  • base_url: 自定义的API基础URL,默认为官方地址
Source

pub fn with_enable_token_cache(self, enable: bool) -> Self

启用或禁用令牌缓存

§参数
  • enable: 是否启用令牌缓存,建议启用以提高性能
Source

pub fn with_req_timeout(self, timeout: Option<f32>) -> Self

设置请求超时时间

§参数
  • timeout: 超时时间(秒),None表示使用默认值
Source

pub fn build(self) -> LarkClient

构建LarkClient实例

根据配置的参数创建最终的客户端实例。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,