1 use {
2 reqwest::Client,
3 smbcloud_model::{account::SmbAuthorization, error_codes::ErrorResponse},
4 smbcloud_network::{environment::Environment, network::request},
5 smbcloud_networking::{
6 constants::PATH_RESEND_CONFIRMATION, smb_base_url_builder, smb_client::SmbClient,
7 },
8 };
9
10 pub async fn resend_email_verification(
11 env: Environment,
12 client: (&SmbClient, &str),
13 email: String,
14 ) -> Result<SmbAuthorization, ErrorResponse> {
15 let builder = Client::new()
16 .post(build_smb_resend_email_verification_url(env, client))
17 .body(format!("email={}", email))
18 .header("User-agent", client.0.id())
19 .header("Accept", "application/json")
20 .header("Content-Type", "application/x-www-form-urlencoded");
21
22 request(builder).await
23 }
24
25 fn build_smb_resend_email_verification_url(env: Environment, client: (&SmbClient, &str)) -> String {
26 let mut url_builder = smb_base_url_builder(env, client);
27 url_builder.add_route(PATH_RESEND_CONFIRMATION);
28 url_builder.build()
29 }