Skip to main content

larksuite_oapi_sdk_rs/
lib.rs

1//! Lark/Feishu OpenAPI SDK for Rust.
2//!
3//! # Quick start
4//!
5//! ```rust,no_run
6//! use larksuite_oapi_sdk_rs::LarkClient;
7//!
8//! let client = LarkClient::builder("APP_ID", "APP_SECRET").build().unwrap();
9//! ```
10//!
11//! # Features
12//!
13//! - **REST services** — 56+ service modules under [`service`] covering IM, Calendar, Drive, etc.
14//! - **Event dispatch** — webhook and WebSocket event routing via [`EventDispatcher`].
15//! - **Typed events** — 200+ typed event structs under [`events`].
16//! - **Card builder** — interactive Lark card construction via [`card`].
17//! - **Channel messaging** — feature-gated (`messaging`) high-level send, reply, edit, upload, and download operations via [`channel::ChannelMessaging`].
18//! - **Channel runtime** — feature-gated (`channel`) inbound event normalization and policy handling; enables `messaging` and `ws`.
19//! - **WebSocket client** — feature-gated (`ws`) persistent long-connection event stream via [`ws::WsClient`].
20//! - **Axum adapter** — feature-gated (`axum`) integration for HTTP servers.
21
22#[macro_use]
23mod macros;
24pub mod cache;
25pub mod card;
26#[cfg(feature = "messaging")]
27pub mod channel;
28pub mod client;
29pub mod config;
30pub mod constants;
31pub mod crypto;
32pub mod error;
33pub mod event;
34pub mod events;
35pub mod http_handler;
36pub mod json;
37pub mod registration;
38pub mod req;
39pub mod resp;
40pub mod service;
41pub mod token;
42pub(crate) mod transport;
43#[cfg(feature = "ws")]
44pub mod ws;
45
46#[cfg(feature = "axum")]
47pub mod axum_handler;
48
49pub use cache::{Cache, LocalCache};
50pub use client::{LarkClient, LarkClientBuilder};
51pub use config::Config;
52pub use constants::{AccessTokenType, AppType, FEISHU_BASE_URL, LARK_BASE_URL};
53// Re-export http::Method so downstream crates can build ApiReq without adding http directly.
54pub use crypto::{
55    encrypted_event_msg, event_decrypt, event_encrypt, verify_signature_sha1,
56    verify_signature_sha256,
57};
58pub use error::LarkError;
59pub use event::{
60    CallbackAction, CallbackCard, CallbackContext, CallbackHandlerFn, CallbackOperator, CardAction,
61    CardActionHandler, CardActionTriggerRequest, CardActionTriggerResponse, CardHandlerFn,
62    CardHandlerResult, CustomResp, CustomizedEventHandlerFn, EventBase, EventDispatcher,
63    EventHandlerFn, EventHeader, EventReq, EventResp, EventV1Header, EventV2Base, EventV2Body,
64    InlinePreview, PreviewUrl, TemplateCard, Toast, ToastI18n, URLPreviewGetRequest,
65    URLPreviewGetResponse,
66};
67pub use http::Method as HttpMethod;
68pub use json::JsonValue;
69pub use req::{
70    ApiReq, FormDataBuilder, FormDataField, FormDataValue, PathParams, QueryParams, ReqBody,
71    RequestOption,
72};
73pub use resp::{ApiResp, CodeError, CodeErrorInfo, RawResponse};
74pub use service::go_compatibility::{
75    GoCompatibility, GoCompatibilityEndpoint, GoCompatibilityEndpointMeta,
76};
77#[allow(deprecated)]
78pub use service::go_compatibility::{GoV397, GoV397Endpoint, GoV397EndpointMeta};
79pub use token::{
80    AppTicketManager, AppTokenResponse, ClientAssertionProvider, MarketplaceAppTokenReq,
81    MarketplaceTenantTokenReq, ResendAppTicketRequest, ResendAppTicketResponse,
82    SelfBuiltAppTokenReq, SelfBuiltTenantTokenReq, TargetInfo, TenantTokenResponse, Token,
83    TokenManager,
84};