MessageService

Struct MessageService 

Source
pub struct MessageService {
    pub config: Config,
}
Expand description

Message service

Provides core message functionality including creating, sending, and retrieving messages. Supports multiple message types: text, post, image, file, audio, media, sticker, interactive, share_chat, share_user.

Service 抽象接入:通过 impl_full_service! 为该服务实现 Service/ServiceObservability/ServiceBuilder/ServiceHealthCheck/ConfigurableService 等核心能力,统一服务行为与可观测性。

Fields§

§config: Config

Service configuration

Implementations§

Source§

impl MessageService

Source

pub async fn list( &self, list_message_request: ListMessageRequest, option: Option<RequestOption>, ) -> SDKResult<ListMessageRespData>

获取会话历史消息

获取会话(包括单聊、群组)的历史消息(聊天记录)

https://open.feishu.cn/document/server-docs/im-v1/message/list

Source

pub fn list_iter( &self, list_message_request: ListMessageRequest, _option: Option<RequestOption>, ) -> ListMessageIterator<'_>

创建消息列表迭代器

提供便捷的方式遍历所有消息,自动处理分页

Source

pub async fn list_with_validated_pagination( &self, container_id: impl ToString, container_id_type: impl ToString, page_size: Option<u32>, page_token: Option<String>, option: Option<RequestOption>, ) -> SDKResult<ListMessageRespData>

使用分页验证创建消息列表请求

提供一个更安全的方式来创建消息列表请求,自动验证分页参数

Source§

impl MessageService

Source

pub async fn create( &self, create_message_request: CreateMessageRequest, option: Option<RequestOption>, ) -> SDKResult<Message>

发送消息

给指定用户或者会话发送消息,支持文本、富文本、可交互的消息卡片、群名片、个人名片、图片、 视频、音频、文件、表情包。

https://open.feishu.cn/document/server-docs/im-v1/message/create

Source

pub async fn delete( &self, message_id: &str, option: Option<RequestOption>, ) -> SDKResult<()>

撤回消息

撤回已经发送成功的消息。支持撤回应用自身发送的消息、应用管理员撤回群成员的消息、 撤回指定用户在指定会话的消息等不同场景。

https://open.feishu.cn/document/server-docs/im-v1/message/delete

Source

pub async fn update( &self, message_id: &str, update_message_request: UpdateMessageRequest, option: Option<RequestOption>, ) -> SDKResult<Message>

更新消息

更新已发送的消息。仅支持更新应用自身发送的文本消息、图片消息和文件消息。

https://open.feishu.cn/document/server-docs/im-v1/message/update

Source

pub async fn reply( &self, message_id: &str, reply_message_request: CreateMessageRequest, option: Option<RequestOption>, ) -> SDKResult<Message>

回复消息

在指定消息下进行回复。支持回复文本、图片、文件等类型的消息。

https://open.feishu.cn/document/server-docs/im-v1/message/reply

Source§

impl MessageService

Source

pub fn new(config: Config) -> Self

Create a new message service instance

Trait Implementations§

Source§

impl Clone for MessageService

Source§

fn clone(&self) -> MessageService

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConfigurableService for MessageService

Source§

fn update_config(&mut self, new_config: Config) -> SDKResult<()>

更新服务配置
Source§

fn validate_config(&self, config: &Config) -> SDKResult<()>

验证新配置的有效性
Source§

impl Debug for MessageService

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExecutableBuilder<MessageService, CreateMessageRequest, Message> for CreateMessageRequestBuilder

Source§

fn build(self) -> CreateMessageRequest

构建请求对象
Source§

fn execute<'life0, 'async_trait>( self, service: &'life0 MessageService, ) -> Pin<Box<dyn Future<Output = SDKResult<Message>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

执行请求并返回响应
Source§

fn execute_with_options<'life0, 'async_trait>( self, service: &'life0 MessageService, option: RequestOption, ) -> Pin<Box<dyn Future<Output = SDKResult<Message>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

带选项执行请求
Source§

impl ExecutableBuilder<MessageService, ListMessageRequest, ListMessageRespData> for ListMessageRequestBuilder

Source§

fn build(self) -> ListMessageRequest

构建请求对象
Source§

fn execute<'life0, 'async_trait>( self, service: &'life0 MessageService, ) -> Pin<Box<dyn Future<Output = SDKResult<ListMessageRespData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

执行请求并返回响应
Source§

fn execute_with_options<'life0, 'async_trait>( self, service: &'life0 MessageService, option: RequestOption, ) -> Pin<Box<dyn Future<Output = SDKResult<ListMessageRespData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

带选项执行请求
Source§

impl Service for MessageService

Source§

fn config(&self) -> &Config

获取服务配置
Source§

fn service_name() -> &'static str

获取服务名称,用于日志和监控
Source§

fn service_version() -> &'static str

服务版本,用于 API 兼容性
Source§

impl ServiceBuilder<MessageService> for MessageService

Source§

fn build(config: Config) -> MessageService

使用配置创建服务实例
Source§

fn build_default() -> S
where Config: Default,

使用默认配置创建服务实例
Source§

impl ServiceHealthCheck for MessageService

Source§

async fn health_check(&self) -> SDKResult<ServiceHealthStatus>

检查服务健康状态
Source§

fn status_summary(&self) -> ServiceStatusSummary
where Self: Sized,

获取服务状态摘要
Source§

fn is_config_valid(&self) -> bool

验证配置是否有效
Source§

impl ServiceObservability for MessageService

Source§

fn log_operation_start(&self, operation: &str, params: Option<&str>)
where Self: Sized,

记录服务操作开始
Source§

fn log_operation_success(&self, operation: &str, duration_ms: u64)
where Self: Sized,

记录服务操作完成
Source§

fn log_operation_error(&self, operation: &str, error: &str, duration_ms: u64)
where Self: Sized,

记录服务操作失败

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,