Skip to main content

u_sdk/email/
mod.rs

1//! 邮件推送sdk
2
3pub use self::types_rs::*;
4mod account;
5pub use account::{DescAccountSummary, DescAccountSummaryBuilder};
6
7mod domain;
8pub use domain::{QueryDomainByParam, QueryDomainByParamBuilder};
9
10mod ip_protection;
11pub use ip_protection::{GetIpProtection, GetIpProtectionBuilder};
12
13mod send_email;
14pub use send_email::{SingleSendEmail, SingleSendEmailBuilder, SingleSendEmailResult};
15
16mod utils;
17
18mod error;
19mod types_rs;
20
21pub use error::Error;
22
23use crate::credentials::CredentialsProvider;
24use bon::bon;
25use std::sync::Arc;
26use u_sdk_common::open_api_sign::OpenApiStyle;
27
28pub struct Client {
29    credentials_provider: Arc<dyn CredentialsProvider>,
30    host: String,
31    http_client: reqwest::Client,
32    style: OpenApiStyle,
33}
34
35#[bon]
36impl Client {
37    #[builder(on(String, into))]
38    pub fn new(credentials_provider: Arc<dyn CredentialsProvider>, host: String) -> Self {
39        Self {
40            credentials_provider,
41            http_client: reqwest::Client::new(),
42            host,
43            style: OpenApiStyle::RPC,
44        }
45    }
46
47    pub fn desc_account_summary(&self) -> DescAccountSummaryBuilder<'_> {
48        DescAccountSummary::builder(self)
49    }
50
51    pub fn query_domain_by_param(&self) -> QueryDomainByParamBuilder<'_> {
52        QueryDomainByParam::builder(self)
53    }
54
55    pub fn get_ip_protection(&self) -> GetIpProtectionBuilder<'_> {
56        GetIpProtection::builder(self)
57    }
58}