Crate tencentcloud_sms_sdk

Source
Expand description

§TencentCloud SMS SDK for Rust

This crate provides a Rust implementation of the TencentCloud SMS SDK, allowing you to send SMS messages through TencentCloud’s SMS service.

§Features

  • Send SMS messages (verification codes, notifications, marketing)
  • Support for both domestic and international SMS
  • Async/await support with tokio
  • TC3-HMAC-SHA256 signature algorithm
  • Comprehensive error handling

§Basic Usage

use tencentcloud_sms_sdk::{Client, Credential, SendSmsRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create credentials
    let credential = Credential::new("your_secret_id", "your_secret_key", None);
     
    // Create client
    let client = Client::new(credential, "ap-guangzhou");
     
    // Create request
    let request = SendSmsRequest::new(
        vec!["+8613800000000".to_string()],
        "1400000000",
        "123456",
        "YourSignature",
        vec!["123456".to_string()],
    );
     
    // Send SMS
    let response = client.send_sms(request).await?;
    println!("SMS sent successfully: {:?}", response);
     
    Ok(())
}

Re-exports§

pub use crate::core::Client;
pub use crate::core::ClientProfile;
pub use crate::core::Credential;
pub use crate::core::HttpProfile;
pub use crate::error::Result;
pub use crate::error::TencentCloudError;
pub use crate::sms::SendSmsRequest;
pub use crate::sms::SendSmsResponse;
pub use crate::sms::SendStatus;

Modules§

core
Core components for the TencentCloud SDK
error
Error types for the TencentCloud SMS SDK
sms
SMS service models and types

Functions§

init_api
Initialize the SDK (placeholder for future initialization needs)
shutdown_api
Shutdown the SDK (placeholder for future cleanup needs)