Skip to content

Commit

Permalink
chore!: Rename all VerifyMethod to VerifMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Dec 5, 2023
1 parent a681875 commit 9f9607d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
30 changes: 15 additions & 15 deletions backend/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"is_catch_all": false,
"is_deliverable": false,
"is_disabled": false,
"method": {
"verif_method": {
"type": "Smtp",
"host": "alt3.gmail-smtp-in.l.google.com."
}
Expand Down Expand Up @@ -278,7 +278,7 @@
"type": "boolean",
"description": "Has this email address been disabled by the email provider?"
},
"method": {
"verif_method": {
"$ref": "#/components/schemas/VerifMethod"
}
},
Expand All @@ -288,7 +288,7 @@
"is_catch_all",
"is_deliverable",
"is_disabled",
"method"
"verif_method"
]
},
"SyntaxDetails": {
Expand Down Expand Up @@ -317,27 +317,27 @@
"enum": ["invalid", "unknown", "safe", "risky"],
"description": "An enum to describe how confident we are that the recipient address is real: `safe`, `risky`, `invalid` and `unknown`. Check our FAQ to know the meanings of the 4 possibilities: https://help.reacher.email/email-attributes-inside-json."
},
"YahooVerifyMethod": {
"YahooVerifMethod": {
"type": "string",
"title": "YahooVerifyMethod",
"title": "YahooVerifMethod",
"enum": ["Api", "Headless", "Smtp"],
"description": "An enum to describe how we verify Yahoo emails."
},
"HotmailVerifyMethod": {
"HotmailVerifMethod": {
"type": "string",
"x-stoplight": {
"id": "tiy37w0jp5x13"
},
"title": "HotmailVerifyMethod",
"title": "HotmailVerifMethod",
"enum": ["Api", "Headless", "Smtp"],
"description": "An enum to describe how we verify Hotmail emails."
},
"GmailVerifyMethod": {
"GmailVerifMethod": {
"type": "string",
"x-stoplight": {
"id": "2p7yqzxi6n3bj"
},
"title": "GmailVerifyMethod",
"title": "GmailVerifMethod",
"enum": ["Api", "Smtp"],
"description": "An enum to describe how we verify Gmail emails.",
"x-internal": false
Expand Down Expand Up @@ -366,14 +366,14 @@
"type": "number",
"description": "SMTP port to use for email validation. Generally, ports 25, 465, 587 and 2525 are used."
},
"yahoo_verify_method": {
"$ref": "#/components/schemas/YahooVerifyMethod"
"yahoo_verif_method": {
"$ref": "#/components/schemas/YahooVerifMethod"
},
"gmail_verify_method": {
"$ref": "#/components/schemas/GmailVerifyMethod"
"gmail_verif_method": {
"$ref": "#/components/schemas/GmailVerifMethod"
},
"hotmail_verify_method": {
"$ref": "#/components/schemas/HotmailVerifyMethod"
"hotmail_verif_method": {
"$ref": "#/components/schemas/HotmailVerifMethod"
},
"check_gravatar": {
"type": "boolean",
Expand Down
12 changes: 6 additions & 6 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ OPTIONS:
The email to use in the `MAIL FROM:` SMTP command [env: FROM_EMAIL=] [default:
reacher.email@gmail.com]

--gmail-verify-method <GMAIL_VERIFY_METHOD>
Select how to verify Gmail email addresses: Api or Smtp [env: GMAIL_VERIFY_METHOD=]
--gmail-verif-method <GMAIL_VERIF_METHOD>
Select how to verify Gmail email addresses: Api or Smtp [env: GMAIL_VERIF_METHOD=]
[default: Smtp]

-h, --help
Expand All @@ -46,9 +46,9 @@ OPTIONS:
--hello-name <HELLO_NAME>
The name to use in the `EHLO:` SMTP command [env: HELLO_NAME=] [default: gmail.com]

--hotmail-verify-method <HOTMAIL_VERIFY_METHOD>
--hotmail-verif-method <HOTMAIL_VERIF_METHOD>
Select how to verify Hotmail email addresses: Api, Headless or Smtp [env:
HOTMAIL_VERIFY_METHOD=] [default: Headless]
HOTMAIL_VERIF_METHOD=] [default: Headless]

--proxy-host <PROXY_HOST>
Use the specified SOCKS5 proxy host to perform email verification [env: PROXY_HOST=]
Expand All @@ -71,9 +71,9 @@ OPTIONS:
-V, --version
Print version information

--yahoo-verify-method <YAHOO_VERIFY_METHOD>
--yahoo-verif-method <YAHOO_VERIF_METHOD>
Select how to verify Yahoo email addresses: Api, Headless or Smtp [env:
YAHOO_VERIFY_METHOD=] [default: Headless]
YAHOO_VERIF_METHOD=] [default: Headless]
```
**💡 PRO TIP:** To show debug logs when running the binary, run:
Expand Down
16 changes: 8 additions & 8 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use check_if_email_exists::{
check_email, CheckEmailInput, CheckEmailInputProxy, GmailVerifyMethod, HotmailVerifyMethod,
YahooVerifyMethod,
check_email, CheckEmailInput, CheckEmailInputProxy, GmailVerifMethod, HotmailVerifMethod,
YahooVerifMethod,
};
use clap::Parser;
use once_cell::sync::Lazy;
Expand Down Expand Up @@ -58,15 +58,15 @@ pub struct Cli {

/// Select how to verify Yahoo email addresses: Api, Headless or Smtp.
#[clap(long, env, default_value = "Headless", parse(try_from_str))]
pub yahoo_verify_method: YahooVerifyMethod,
pub yahoo_verif_method: YahooVerifMethod,

/// Select how to verify Gmail email addresses: Api or Smtp.
#[clap(long, env, default_value = "Smtp", parse(try_from_str))]
pub gmail_verify_method: GmailVerifyMethod,
pub gmail_verif_method: GmailVerifMethod,

/// Select how to verify Hotmail email addresses: Api, Headless or Smtp.
#[clap(long, env, default_value = "Headless", parse(try_from_str))]
pub hotmail_verify_method: HotmailVerifyMethod,
pub hotmail_verif_method: HotmailVerifMethod,

/// Whether to check if a gravatar image is existing for the given email.
#[clap(long, env, default_value = "false", parse(try_from_str))]
Expand Down Expand Up @@ -94,9 +94,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
.set_from_email(CONF.from_email.clone())
.set_hello_name(CONF.hello_name.clone())
.set_smtp_port(CONF.smtp_port)
.set_yahoo_verify_method(CONF.yahoo_verify_method)
.set_gmail_verify_method(CONF.gmail_verify_method)
.set_hotmail_verify_method(CONF.hotmail_verify_method)
.set_yahoo_verif_method(CONF.yahoo_verif_method)
.set_gmail_verif_method(CONF.gmail_verif_method)
.set_hotmail_verif_method(CONF.hotmail_verif_method)
.set_check_gravatar(CONF.check_gravatar)
.set_haveibeenpwned_api_key(CONF.haveibeenpwned_api_key.clone());

Expand Down
16 changes: 8 additions & 8 deletions core/src/smtp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use serde::{Deserialize, Serialize};
use trust_dns_proto::rr::Name;

use crate::{
util::input_output::CheckEmailInput, GmailVerifyMethod, HotmailVerifyMethod, YahooVerifyMethod,
util::input_output::CheckEmailInput, GmailVerifMethod, HotmailVerifMethod, YahooVerifMethod,
};
use connect::check_smtp_with_retry;
pub use error::*;
Expand Down Expand Up @@ -102,8 +102,8 @@ pub async fn check_smtp(
let webdriver_addr = env::var("RCH_WEBDRIVER_ADDR");

if is_hotmail(&host) {
match (&input.hotmail_verify_method, webdriver_addr) {
(HotmailVerifyMethod::OneDriveApi, _) => {
match (&input.hotmail_verif_method, webdriver_addr) {
(HotmailVerifMethod::OneDriveApi, _) => {
if is_microsoft365(&host) {
match outlook::microsoft365::check_microsoft365_api(to_email, input).await {
Ok(Some(smtp_details)) => return Ok(smtp_details),
Expand All @@ -116,7 +116,7 @@ pub async fn check_smtp(
}
}
#[cfg(feature = "headless")]
(HotmailVerifyMethod::Headless, Ok(a)) => {
(HotmailVerifMethod::Headless, Ok(a)) => {
return outlook::headless::check_password_recovery(
to_email.to_string().as_str(),
&a,
Expand All @@ -127,20 +127,20 @@ pub async fn check_smtp(
_ => {}
};
} else if is_gmail(&host) {
if let GmailVerifyMethod::Api = &input.gmail_verify_method {
if let GmailVerifMethod::Api = &input.gmail_verif_method {
return gmail::check_gmail(to_email, input)
.await
.map_err(|err| err.into());
};
} else if is_yahoo(&host) {
match (&input.yahoo_verify_method, webdriver_addr) {
(YahooVerifyMethod::Api, _) => {
match (&input.yahoo_verif_method, webdriver_addr) {
(YahooVerifMethod::Api, _) => {
return yahoo::check_api(&to_email_str, input)
.await
.map_err(|e| e.into())
}
#[cfg(feature = "headless")]
(YahooVerifyMethod::Headless, Ok(a)) => {
(YahooVerifMethod::Headless, Ok(a)) => {
return yahoo::check_headless(&to_email_str, &a)
.await
.map_err(|e| e.into())
Expand Down
46 changes: 23 additions & 23 deletions core/src/util/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SmtpSecurity {

/// Select how to verify Yahoo emails.
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
pub enum YahooVerifyMethod {
pub enum YahooVerifMethod {
/// Use Yahoo's API to check if an email exists.
Api,
/// Use Yahoo's password recovery page to check if an email exists.
Expand All @@ -89,7 +89,7 @@ pub enum YahooVerifyMethod {
Smtp,
}

impl FromStr for YahooVerifyMethod {
impl FromStr for YahooVerifMethod {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand All @@ -105,14 +105,14 @@ impl FromStr for YahooVerifyMethod {

/// Select how to verify Gmail emails.
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
pub enum GmailVerifyMethod {
pub enum GmailVerifMethod {
/// Use Gmail's API to check if an email exists.
Api,
/// Use Gmail's SMTP servers to check if an email exists.
Smtp,
}

impl FromStr for GmailVerifyMethod {
impl FromStr for GmailVerifMethod {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand All @@ -126,7 +126,7 @@ impl FromStr for GmailVerifyMethod {

/// Select how to verify Hotmail emails.
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
pub enum HotmailVerifyMethod {
pub enum HotmailVerifMethod {
/// Use OneDrive API to check if an email exists.
OneDriveApi,
/// Use Hotmail's password recovery page to check if an email exists.
Expand All @@ -141,7 +141,7 @@ pub enum HotmailVerifyMethod {
Smtp,
}

impl FromStr for HotmailVerifyMethod {
impl FromStr for HotmailVerifMethod {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand Down Expand Up @@ -187,15 +187,15 @@ pub struct CheckEmailInput {
/// Select how to verify Yahoo emails.
///
/// Defaults to Headless.
pub yahoo_verify_method: YahooVerifyMethod,
pub yahoo_verif_method: YahooVerifMethod,
/// Select how to verify Gmail addresses.
///
/// Defaults to Smtp.
pub gmail_verify_method: GmailVerifyMethod,
pub gmail_verif_method: GmailVerifMethod,
/// Select how to verify Hotmail/Outlook/Microsoft email addresses.
///
/// Defaults to Headless.
pub hotmail_verify_method: HotmailVerifyMethod,
pub hotmail_verif_method: HotmailVerifMethod,
// Whether to check if a gravatar image is existing for the given email.
//
// Defaults to false.
Expand Down Expand Up @@ -243,14 +243,14 @@ impl Default for CheckEmailInput {
smtp_security: SmtpSecurity::default(),
smtp_timeout: Some(Duration::from_secs(12)),
#[cfg(not(feature = "headless"))]
yahoo_verify_method: YahooVerifyMethod::Api,
yahoo_verif_method: YahooVerifMethod::Api,
#[cfg(feature = "headless")]
yahoo_verify_method: YahooVerifyMethod::Headless,
gmail_verify_method: GmailVerifyMethod::Smtp,
yahoo_verif_method: YahooVerifMethod::Headless,
gmail_verif_method: GmailVerifMethod::Smtp,
#[cfg(not(feature = "headless"))]
yahoo_verify_method: HotmailVerifyMethod::Smtp,
yahoo_verif_method: HotmailVerifMethod::Smtp,
#[cfg(feature = "headless")]
hotmail_verify_method: HotmailVerifyMethod::Headless,
hotmail_verif_method: HotmailVerifMethod::Headless,
check_gravatar: false,
haveibeenpwned_api_key: None,
retries: 2,
Expand Down Expand Up @@ -350,32 +350,32 @@ impl CheckEmailInput {

/// Set whether to use Yahoo's API, headless navigator, or connecting
/// directly to their SMTP servers. Defaults to Headless.
pub fn set_yahoo_verify_method(
pub fn set_yahoo_verif_method(
&mut self,
verify_method: YahooVerifyMethod,
verif_method: YahooVerifMethod,
) -> &mut CheckEmailInput {
self.yahoo_verify_method = verify_method;
self.yahoo_verif_method = verif_method;
self
}

/// Set whether to use Gmail's API or connecting directly to their SMTP
/// servers. Defaults to false.
pub fn set_gmail_verify_method(
pub fn set_gmail_verif_method(
&mut self,
verify_method: GmailVerifyMethod,
verif_method: GmailVerifMethod,
) -> &mut CheckEmailInput {
self.gmail_verify_method = verify_method;
self.gmail_verif_method = verif_method;
self
}

/// Set whether to use Microsoft 365's OneDrive API, a headless navigator,
/// or connecting directly to their SMTP servers for hotmail addresse.
/// Defaults to Headless.
pub fn set_hotmail_verify_method(
pub fn set_hotmail_verif_method(
&mut self,
verify_method: HotmailVerifyMethod,
verif_method: HotmailVerifMethod,
) -> &mut CheckEmailInput {
self.hotmail_verify_method = verify_method;
self.hotmail_verif_method = verif_method;
self
}

Expand Down

0 comments on commit 9f9607d

Please sign in to comment.