Expand description
DingTalk API SDK for Rust.
This crate provides:
- async client (
Client) and services (WebhookService,EnterpriseService) - optional blocking client (
BlockingClient) and services - typed request/response models for contacts and approvals
- unified error model and transport profiles/retry integration via
reqx
§Quick Start (Async)
#[cfg(feature = "_async")]
use dingtalk_sdk::Client;
#[cfg(feature = "_async")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder().build()?;
let webhook = client.webhook("your_token", Some("your_secret".into()));
let _ = webhook
.send_text_message("Hello from rustdoc", None, None, Some(false))
.await?;
Ok(())
}
#[cfg(not(feature = "_async"))]
fn main() {}§Feature Overview
At least one runtime mode is required:
_async(internal)_blocking(internal)
Each enabled runtime mode requires exactly one TLS backend:
- async:
async-tls-rustls-ring/async-tls-rustls-aws-lc-rs/async-tls-native - blocking:
blocking-tls-rustls-ring/blocking-tls-rustls-aws-lc-rs/blocking-tls-native
In normal usage, select TLS features directly. They automatically enable the matching runtime mode.
Structs§
- Action
Card Button - Public webhook and enterprise request/response helper types.
Re-exported webhook message helper types.
Multi-button
actionCardbutton item. - AppCredentials
- Application credentials used by enterprise APIs.
Enterprise app credentials (
appkey+appsecret). - Approval
Create Process Instance Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for creating an approval process instance.
- Approval
Form Component Value - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Form field item for approval instance creation.
- Approval
List Process Instance IdsRequest - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for listing approval process instance ids.
- Approval
List Process Instance IdsResult - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for process-instance id listing.
- Approval
Process Instance - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Typed approval process instance payload.
- Approval
Terminate Process Instance Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for terminating an approval process instance.
- Body
Snippet Config - Controls whether and how response snippets are retained in errors. Configuration for attaching a redacted body snippet to API errors.
- Client
_async - Async DingTalk SDK client.
- Client
Builder _async - Builder for async
Client. - Contact
Create Department Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for creating a department.
- Contact
Create Department Result - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for creating a department.
- Contact
Create User Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for creating a user.
- Contact
Create User Result - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for contact user creation.
- Contact
Delete Department Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for deleting a department.
- Contact
Delete User Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for deleting a user.
- Contact
Department - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Typed department object from contact APIs.
- Contact
GetDepartment Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for getting a department.
- Contact
GetUser ByMobile Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for getting a user by mobile number.
- Contact
GetUser ByUnion IdRequest - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for getting a user by union id.
- Contact
GetUser Request - Public webhook and enterprise request/response helper types.
Re-exported enterprise request/response types.
Request for getting a user by
userid. - Contact
List SubDepartment IdsRequest - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for listing child department ids.
- Contact
List SubDepartment IdsResult - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for listing child department ids.
- Contact
List SubDepartments Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for listing child departments.
- Contact
List SubDepartments Result - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for listing child departments.
- Contact
List Users Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for listing users in a department.
- Contact
List Users Result - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Response payload for contact user listing.
- Contact
Update Department Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for updating a department.
- Contact
Update User Request - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Request for updating a user.
- Contact
User - Public webhook and enterprise request/response helper types. Re-exported enterprise request/response types. Typed user object from contact APIs.
- Enterprise
Service _async - Async enterprise service. Async enterprise robot service.
- Feed
Card Link - Public webhook and enterprise request/response helper types.
Re-exported webhook message helper types.
feedCardlink item. - Http
Error - SDK error type and helpers. Structured HTTP error context.
- Retry
Policy - reqx retry policy for DingTalk clients.
- Transport
Error - SDK error type and helpers. Structured transport error context.
- Webhook
Service _async - Async webhook service. Async webhook robot service.
Enums§
- Client
Profile - reqx transport profile presets for DingTalk clients.
- Error
- SDK error type and helpers. Unified SDK error type.
- Error
Kind - SDK error type and helpers. Stable high-level error category.
Type Aliases§
- Result
- SDK error type and helpers. SDK result type.