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_RESET_PASSWORD_INSTRUCTIONS, smb_base_url_builder, smb_client::SmbClient,
7 },
8 };
9
10 pub async fn resend_reset_password_instruction(
11 env: Environment,
12 client: (&SmbClient, &str),
13 email: String,
14 ) -> Result<SmbAuthorization, ErrorResponse> {
15 let builder = Client::new()
16 .post(build_smb_resend_reset_password_instructions_url(
17 env, client,
18 ))
19 .body(format!("email={}", email))
20 .header("User-agent", client.0.id())
21 .header("Accept", "application/json")
22 .header("Content-Type", "application/x-www-form-urlencoded");
23
24 request(builder).await
25 }
26
27 fn build_smb_resend_reset_password_instructions_url(
28 env: Environment,
29 client: (&SmbClient, &str),
30 ) -> String {
31 let mut url_builder = smb_base_url_builder(env, client);
32 url_builder.add_route(PATH_RESET_PASSWORD_INSTRUCTIONS);
33 url_builder.build()
34 }