pub struct DingTalkRobot { /* private fields */ }Expand description
Implementation of the DingTalk Webhook Bot.
Implementations§
Source§impl DingTalkRobot
impl DingTalkRobot
Sourcepub fn new(token: String, secret: Option<String>) -> Self
pub fn new(token: String, secret: Option<String>) -> Self
Creates a new instance of DingTalkRobot.
§Arguments
token- The access token for the DingTalk bot.secret- An optional secret for signature generation.
Sourcepub async fn send_text_message(
&self,
content: &str,
at_mobiles: Option<Vec<String>>,
at_user_ids: Option<Vec<String>>,
is_at_all: Option<bool>,
) -> Result<String, DingTalkError>
pub async fn send_text_message( &self, content: &str, at_mobiles: Option<Vec<String>>, at_user_ids: Option<Vec<String>>, is_at_all: Option<bool>, ) -> Result<String, DingTalkError>
Sends a text message.
§Arguments
content- The content of the text message.at_mobiles- Optional list of mobile numbers to mention.at_user_ids- Optional list of user IDs to mention.is_at_all- Optional flag indicating whether to mention all users.
§Returns
A Result containing the response text or a DingTalkError.
Sourcepub async fn send_link_message(
&self,
title: &str,
text: &str,
message_url: &str,
pic_url: Option<&str>,
) -> Result<String, DingTalkError>
pub async fn send_link_message( &self, title: &str, text: &str, message_url: &str, pic_url: Option<&str>, ) -> Result<String, DingTalkError>
Sourcepub async fn send_markdown_message(
&self,
title: &str,
text: &str,
at_mobiles: Option<Vec<String>>,
at_user_ids: Option<Vec<String>>,
is_at_all: Option<bool>,
) -> Result<String, DingTalkError>
pub async fn send_markdown_message( &self, title: &str, text: &str, at_mobiles: Option<Vec<String>>, at_user_ids: Option<Vec<String>>, is_at_all: Option<bool>, ) -> Result<String, DingTalkError>
Sends a Markdown message.
§Arguments
title- The title of the Markdown message.text- The Markdown formatted content.at_mobiles- Optional list of mobile numbers to mention.at_user_ids- Optional list of user IDs to mention.is_at_all- Optional flag indicating whether to mention all users.
§Returns
A Result containing the response text or a DingTalkError.
Sourcepub async fn send_action_card_message_single(
&self,
title: &str,
text: &str,
single_title: &str,
single_url: &str,
btn_orientation: Option<&str>,
) -> Result<String, DingTalkError>
pub async fn send_action_card_message_single( &self, title: &str, text: &str, single_title: &str, single_url: &str, btn_orientation: Option<&str>, ) -> Result<String, DingTalkError>
Sends an ActionCard message with a single redirection button.
This version uses a single button that redirects to the provided URL.
§Arguments
title- The title of the ActionCard message.text- The content of the message.single_title- The title of the single button.single_url- The URL to redirect when the button is clicked.btn_orientation- Optional button orientation.
§Returns
A Result containing the response text or a DingTalkError.
Sourcepub async fn send_action_card_message_multi(
&self,
title: &str,
text: &str,
btns: Vec<ActionCardButton>,
btn_orientation: Option<&str>,
) -> Result<String, DingTalkError>
pub async fn send_action_card_message_multi( &self, title: &str, text: &str, btns: Vec<ActionCardButton>, btn_orientation: Option<&str>, ) -> Result<String, DingTalkError>
Sends an ActionCard message with multiple buttons, each having its own URL.
§Arguments
title- The title of the ActionCard message.text- The content of the message.btns- A vector ofActionCardButtonrepresenting the buttons.btn_orientation- Optional button orientation.
§Returns
A Result containing the response text or a DingTalkError.
Sourcepub async fn send_feed_card_message(
&self,
links: Vec<FeedCardLink>,
) -> Result<String, DingTalkError>
pub async fn send_feed_card_message( &self, links: Vec<FeedCardLink>, ) -> Result<String, DingTalkError>
Auto Trait Implementations§
impl Freeze for DingTalkRobot
impl !RefUnwindSafe for DingTalkRobot
impl Send for DingTalkRobot
impl Sync for DingTalkRobot
impl Unpin for DingTalkRobot
impl !UnwindSafe for DingTalkRobot
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