[−][src]Struct dingtalk::DingTalk
DingTalk
is a simple SDK for DingTalk webhook robot
Document https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq
Sample code:
ⓘ
let dt = DingTalk::new("<token>", ""); dt.send_text("Hello world!")?;
At all sample:
ⓘ
dt.send_message(&DingTalkMessage::new_text("Hello World!").at_all())?;
Fields
dingtalk_type: DingTalkType
default_webhook_url: String
access_token: String
sec_token: String
direct_url: String
proxy: Option<String>
Implementations
impl DingTalk
[src]
pub fn from_token(token: &str) -> XResult<Self>
[src]
Create DingTalk
from token:
wechatwork:access_token
dingtalk:access_token?sec_token
pub fn from_file(f: &str) -> XResult<Self>
[src]
Create DingTalk
from file
Format see DingTalk::from_json(json: &str)
pub fn from_json(json: &str) -> XResult<Self>
[src]
Create DingTalk
from JSON string
Format:
{
"default_webhook_url": "", // option
"access_token": "<access token>",
"sec_token": "<sec token>" // option
}
pub fn from_url(direct_url: &str) -> Self
[src]
Create DingTalk
from url, for outgoing robot
pub fn new(access_token: &str, sec_token: &str) -> Self
[src]
Create DingTalk
access_token
is access token, sec_token
can be empty ""
pub fn new_wechat(key: &str) -> Self
[src]
Create DingTalk
for WeChat Work
pub fn proxy(self, proxy: &str) -> Self
[src]
Set send ding talk proxy
pub fn set_default_webhook_url(&mut self, default_webhook_url: &str)
[src]
Set default webhook url
pub async fn send_message(
&self,
dingtalk_message: DingTalkMessage
) -> XResult<()>
[src]
&self,
dingtalk_message: DingTalkMessage
) -> XResult<()>
Send DingTalk message
- Create DingTalk JSON message
- POST JSON message to DingTalk server
pub async fn send_text(&self, text_message: &str) -> XResult<()>
[src]
Send text message
pub async fn send_markdown(&self, title: &str, text: &str) -> XResult<()>
[src]
Send markdown message
pub async fn send_link(
&self,
link_title: &str,
link_text: &str,
link_pic_url: &str,
link_message_url: &str
) -> XResult<()>
[src]
&self,
link_title: &str,
link_text: &str,
link_pic_url: &str,
link_message_url: &str
) -> XResult<()>
Send link message
pub async fn send(&self, json_message: &str) -> XResult<()>
[src]
Direct send JSON message
pub fn generate_signed_url(&self) -> XResult<String>
[src]
Generate signed dingtalk webhook URL
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DingTalk
[src]
impl Send for DingTalk
[src]
impl Sync for DingTalk
[src]
impl Unpin for DingTalk
[src]
impl UnwindSafe for DingTalk
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,