debox_open_sdk/lib.rs
1//! # debox-open-sdk
2//!
3//! This project is the programming interface of Debox social chat service (Chat Service) API, the encapsulation and implementation of Chat Service Rest API, to help developers program and use Debox's chat message service faster.
4//! For detailed API interface and meaning, please refer to: https://docs.debox.love
5//!
6//! ## Usage
7//! ```rust
8//! use debox_open_sdk::{RegisterCallbackUrlBody, Client, ClientOptions, SendChatMsgBody};
9//!
10//! #[tokio::main]
11//! async fn main() {
12//! let opt = ClientOptions {
13//! endpoint: "https://open.debox.pro".to_string(),
14//! api_key: "api_key".to_string(),
15//! user_agent: None,
16//! request_time_out: None,
17//! auth_version: None,
18//! };
19//! let client = Client::new(&opt);
20//! let body = RegisterCallbackUrlBody {
21//! url: "http://xxx.com".to_string(),
22//! http_method: "POST".to_string(),
23//! };
24//! let res = client.register_callbak_url(&body).await;
25//! match res {
26//! Ok(res) => {
27//! println!("register_callbak_url res: {:?}", res);
28//! }
29//! Err(e) => {
30//! println!("register_callbak_url err: {:?}", e);
31//! }
32//! }
33//! let body = SendChatMsgBody {
34//! group_id: "group_id".to_string(),
35//! to_user_id: "DeBox.Love".to_string(),
36//! message: "Hello World".to_string(),
37//! };
38//! let res = client.send_chat_msg(&body).await;
39//! match res {
40//! Ok(res) => {
41//! println!("send_chat_msg res: {:?}", res);
42//! }
43//! Err(e) => {
44//! println!("send_chat_msg err: {:?}", e);
45//! }
46//! }
47//! }
48//! ```
49//!
50
51mod api_client;
52mod client;
53
54pub use api_client::{ApiResult, RegisterCallbackUrlBody, SendChatMsgBody};
55pub use client::{Client, ClientOptions};