1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// @generated by xtask/generate_services.py — do not edit by hand.
//! `email-isv` — typed methods for all 1 API v2 operations
//! in this module.
//!
//! Access via [`Ghl::email_isv`](crate::Ghl::email_isv)
//!
//! Request and response types come from [`ghl_models::v2::email_isv`](https://docs.rs/ghl-models/latest/ghl_models/v2/email_isv/); every endpoint is also documented in the
//! [`email-isv` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/email-isv.md).
//!
//! Enable with `features = ["email-isv"]`.
#![allow(clippy::too_many_arguments)]
use crate::client::Ghl;
use crate::error::Result;
use ghl_models::v2::email_isv as models;
/// Typed access to the `email-isv` API (1 operations). Obtained via
/// [`Ghl::email_isv`](crate::Ghl::email_isv).
#[derive(Debug, Clone)]
pub struct EmailIsvService {
pub(crate) client: Ghl,
}
impl EmailIsvService {
pub(crate) fn new(client: Ghl) -> Self {
Self { client }
}
}
/// Query parameters for [`EmailIsvService::email_verification`].
#[derive(Debug, Clone, Default)]
pub struct EmailVerificationParams {
/// Location Id, The email verification charges will be deducted from this location (if
/// rebilling is enabled) / company wallet
/// Required by the API.
pub location_id: String,
}
impl EmailVerificationParams {
/// Start from the parameters the API requires.
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
q
}
}
impl EmailIsvService {
/// Email Verification
///
/// Verify Email
///
/// `POST /email/verify`
pub async fn email_verification(
&self,
params: &EmailVerificationParams,
body: &models::VerificationBodyDto,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::POST,
"/email/verify",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
}