pub struct ZeroBounce {
pub api_key: String,
pub base_url: String,
pub client: Client,
pub url_provider: ZBUrlProvider,
}Fields§
§api_key: String§base_url: String§client: Client§url_provider: ZBUrlProviderImplementations§
Source§impl ZeroBounce
impl ZeroBounce
pub fn bulk_validation_file_submit( &self, zb_file: &ZBFile, ) -> ZBResult<ZBFileFeedback>
pub fn bulk_validation_file_status_check( &self, file_id: &str, ) -> ZBResult<ZBFileStatus>
pub fn bulk_validation_result_fetch( &self, file_id: &str, ) -> ZBResult<ZBBulkResponse>
Sourcepub fn bulk_validation_result_fetch_with_options(
&self,
file_id: &str,
options: &ZBGetFileOptions,
) -> ZBResult<ZBBulkResponse>
pub fn bulk_validation_result_fetch_with_options( &self, file_id: &str, options: &ZBGetFileOptions, ) -> ZBResult<ZBBulkResponse>
Bulk validation getfile with optional v2 query parameters (download_type, activity_data).
pub fn bulk_validation_result_delete( &self, file_id: &str, ) -> ZBResult<ZBFileFeedback>
pub fn ai_scoring_file_submit( &self, zb_file: &ZBFile, ) -> ZBResult<ZBFileFeedback>
pub fn ai_scoring_file_status_check( &self, file_id: &str, ) -> ZBResult<ZBFileStatus>
pub fn ai_scoring_result_fetch(&self, file_id: &str) -> ZBResult<ZBBulkResponse>
Sourcepub fn ai_scoring_result_fetch_with_options(
&self,
file_id: &str,
options: &ZBGetFileOptions,
) -> ZBResult<ZBBulkResponse>
pub fn ai_scoring_result_fetch_with_options( &self, file_id: &str, options: &ZBGetFileOptions, ) -> ZBResult<ZBBulkResponse>
AI scoring getfile with optional download_type (activity_data is not sent).
pub fn ai_scoring_result_delete( &self, file_id: &str, ) -> ZBResult<ZBFileFeedback>
Source§impl ZeroBounce
impl ZeroBounce
Sourcepub fn get_inbox_placement_providers(&self) -> ZBResult<Value>
pub fn get_inbox_placement_providers(&self) -> ZBResult<Value>
Seed providers available for new tests. GET /providers
Sourcepub fn get_inbox_placement_test_types(&self) -> ZBResult<Value>
pub fn get_inbox_placement_test_types(&self) -> ZBResult<Value>
Supported test types and the default one. GET /test-types
Sourcepub fn create_inbox_placement_test(
&self,
name: &str,
options: &CreateInboxPlacementTestOptions,
) -> ZBResult<Value>
pub fn create_inbox_placement_test( &self, name: &str, options: &CreateInboxPlacementTestOptions, ) -> ZBResult<Value>
Create an inbox placement test. POST /test
name must be non-empty and at most 64 characters. Spends one inbox test.
Sourcepub fn get_inbox_placement_test(&self, test_id: &str) -> ZBResult<Value>
pub fn get_inbox_placement_test(&self, test_id: &str) -> ZBResult<Value>
A test and its placement results. GET /test/{id}
Sourcepub fn list_inbox_placement_tests(
&self,
options: &ListInboxPlacementTestsOptions,
) -> ZBResult<Value>
pub fn list_inbox_placement_tests( &self, options: &ListInboxPlacementTestsOptions, ) -> ZBResult<Value>
List tests, newest first. GET /tests
Sourcepub fn delete_inbox_placement_test(&self, test_id: &str) -> ZBResult<Value>
pub fn delete_inbox_placement_test(&self, test_id: &str) -> ZBResult<Value>
Delete a finished test. DELETE /test/{id}
The API may answer with 204 No Content. An empty 2xx is a success
and comes back as Value::Null.
Sourcepub fn get_inbox_placement_webhook(&self) -> ZBResult<Value>
pub fn get_inbox_placement_webhook(&self) -> ZBResult<Value>
The webhook URL saved on this API key. GET /webhook
Sourcepub fn set_inbox_placement_webhook(&self, webhook_url: &str) -> ZBResult<Value>
pub fn set_inbox_placement_webhook(&self, webhook_url: &str) -> ZBResult<Value>
Save the URL finished results are posted to. PUT /webhook
Source§impl ZeroBounce
impl ZeroBounce
Sourcepub fn send_email_finder_file(
&self,
domain_column: u32,
options: &ZBEmailFinderFileOptions,
file_name: &str,
reader: impl Read,
) -> ZBResult<ZBFileFeedback>
pub fn send_email_finder_file( &self, domain_column: u32, options: &ZBEmailFinderFileOptions, file_name: &str, reader: impl Read, ) -> ZBResult<ZBFileFeedback>
Submit a file to the bulk email finder (POST /email-finder/sendfile).
domain_column is required and 1-based. Either first_name_column or
full_name_column must be set on options: the API has no way to guess a
person from a domain alone and rejects a file that carries neither.
pub fn email_finder_file_status(&self, file_id: &str) -> ZBResult<String>
Sourcepub fn email_finder_result_fetch(
&self,
file_id: &str,
) -> ZBResult<ZBBulkResponse>
pub fn email_finder_result_fetch( &self, file_id: &str, ) -> ZBResult<ZBBulkResponse>
Download a finished bulk email finder file (GET /email-finder/getfile).
On success the bytes come back as ZBBulkResponse::Content. A JSON body,
including an HTTP 200 carrying {"success": false}, is an error, the same
as bulk_validation_result_fetch.
Sourcepub fn email_finder_result_delete(
&self,
file_id: &str,
) -> ZBResult<ZBFileFeedback>
pub fn email_finder_result_delete( &self, file_id: &str, ) -> ZBResult<ZBFileFeedback>
Delete a bulk email finder file and its results (GET /email-finder/deletefile).
pub fn domain_search_file_status(&self, file_id: &str) -> ZBResult<String>
Sourcepub fn domain_search_result_fetch(
&self,
file_id: &str,
) -> ZBResult<ZBBulkResponse>
pub fn domain_search_result_fetch( &self, file_id: &str, ) -> ZBResult<ZBBulkResponse>
Download a finished bulk domain search file (GET /domain-search/getfile).
Same success and error rules as
email_finder_result_fetch.
Sourcepub fn domain_search_result_delete(
&self,
file_id: &str,
) -> ZBResult<ZBFileFeedback>
pub fn domain_search_result_delete( &self, file_id: &str, ) -> ZBResult<ZBFileFeedback>
Delete a bulk domain search file and its results (GET /domain-search/deletefile).
Sourcepub fn send_evaluated_file(&self, file_id: &str) -> ZBResult<ZBFileFeedback>
pub fn send_evaluated_file(&self, file_id: &str) -> ZBResult<ZBFileFeedback>
Submit a finished evaluation for validation. POST /v2/send-evaluated-file/
LIVE: this takes the list evaluator’s file_id as a form field, not the
file upload the docs describe — an upload is rejected with
“file_id: This field is required”. It returns a new validation job’s
file_id, which answers “File cannot be found” for a short while after
it is accepted.
Sourcepub fn send_domain_search_file(
&self,
domain_column: u32,
has_header_row: Option<bool>,
file_name: &str,
reader: impl Read,
) -> ZBResult<ZBFileFeedback>
pub fn send_domain_search_file( &self, domain_column: u32, has_header_row: Option<bool>, file_name: &str, reader: impl Read, ) -> ZBResult<ZBFileFeedback>
Submit a file to bulk domain search (POST /domain-search/sendfile).
has_header_row is omitted when None, so the account default applies.
pub fn send_list_evaluator_file( &self, email_address_column: u32, file_name: &str, reader: impl Read, ) -> ZBResult<ZBFileFeedback>
pub fn get_list_evaluator_result(&self, file_id: &str) -> ZBResult<Value>
pub fn add_filter( &self, rule: &str, target: &str, value: &str, ) -> ZBResult<Value>
pub fn list_filters(&self, use_post: bool) -> ZBResult<Value>
pub fn delete_filter( &self, rule: &str, target: &str, value: &str, ) -> ZBResult<Value>
pub fn list_s3_files( &self, bucket: Option<&str>, search: Option<&str>, ) -> ZBResult<Vec<S3ListFileEntry>>
Sourcepub fn validate_s3_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn validate_s3_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Validate a file in your Amazon S3 bucket (POST /validateS3file).
file_name is the full path as returned by list_s3_files.
Sourcepub fn score_s3_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn score_s3_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
AI score a file in your Amazon S3 bucket (POST /scoreS3file).
Sourcepub fn export_s3_file(
&self,
file_id: &str,
export_bucket: Option<&str>,
) -> ZBResult<ZBFileFeedback>
pub fn export_s3_file( &self, file_id: &str, export_bucket: Option<&str>, ) -> ZBResult<ZBFileFeedback>
Export a validated or scored file back to Amazon S3 (POST /exportS3file).
Pass None to use the export bucket from your ZeroBounce settings. Note the
field name: export_sftp_file takes export_path.
Sourcepub fn email_finder_s3_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn email_finder_s3_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Run the email finder on a file in your Amazon S3 bucket (POST /emailFinderS3file).
file_name is the full path as returned by list_s3_files.
Sourcepub fn domain_search_s3_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn domain_search_s3_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Run domain search on a file in your Amazon S3 bucket (POST /domainSearchS3file).
Sourcepub fn validate_sftp_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn validate_sftp_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Validate a file from your SFTP/FTP server (POST /validateSFTPfile).
LIVE: file_name is required here too, although the docs list it as
optional for this one endpoint.
Sourcepub fn score_sftp_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn score_sftp_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Score a file from your SFTP/FTP server (POST /scoreSFTPfile).
file_name is a plain name such as my_file.txt.
Sourcepub fn email_finder_sftp_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn email_finder_sftp_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Run the email finder on a file from your SFTP/FTP server (POST /emailFinderSFTPfile).
Sourcepub fn domain_search_sftp_file(
&self,
file_name: &str,
has_header_row: bool,
remove_duplicates: Option<bool>,
return_url: &str,
) -> ZBResult<ZBFileFeedback>
pub fn domain_search_sftp_file( &self, file_name: &str, has_header_row: bool, remove_duplicates: Option<bool>, return_url: &str, ) -> ZBResult<ZBFileFeedback>
Run domain search on a file from your SFTP/FTP server (POST /domainSearchSFTPfile).
Sourcepub fn export_sftp_file(
&self,
file_id: &str,
export_path: Option<&str>,
) -> ZBResult<ZBFileFeedback>
pub fn export_sftp_file( &self, file_id: &str, export_path: Option<&str>, ) -> ZBResult<ZBFileFeedback>
Export a validated or scored file back to your SFTP/FTP server (POST /exportSFTPfile).
Note the field name: this endpoint takes export_path, not the export_bucket
that export_s3_file uses. Pass None to use the export
path from your ZeroBounce settings.
Source§impl ZeroBounce
impl ZeroBounce
pub fn validate_email_and_ip( &self, email: &str, ip_address: &str, ) -> ZBResult<ZBValidation>
pub fn validate_email_with_options( &self, email: &str, ip_address: &str, options: &ZBValidateOptions, ) -> ZBResult<ZBValidation>
pub fn validate_email(&self, email: &str) -> ZBResult<ZBValidation>
pub fn batch_validate( &self, emails_and_ip_addresses: Vec<(String, String)>, ) -> ZBResult<ZBBatchValidation>
pub fn batch_validate_with_options( &self, emails_and_ip_addresses: Vec<(String, String)>, options: &ZBValidateOptions, ) -> ZBResult<ZBBatchValidation>
Source§impl ZeroBounce
impl ZeroBounce
pub fn get_credits(&self) -> ZBResult<i64>
pub fn get_api_usage( &self, start_date: NaiveDate, end_date: NaiveDate, ) -> ZBResult<ApiUsage>
pub fn get_api_usage_overall(&self) -> ZBResult<ApiUsage>
pub fn get_activity_data(&self, email: &str) -> ZBResult<ActivityData>
pub fn score_email(&self, email: &str) -> ZBResult<ScoreEmailResponse>
pub fn score_email_post(&self, email: &str) -> ZBResult<ScoreEmailResponse>
Sourcepub fn find_email(
&self,
domain: &str,
first_name: &str,
middle_name: &str,
last_name: &str,
) -> ZBResult<FindEmailResponse>
👎Deprecated since 1.2.0: Use find_email_v2 instead. The new version supports both domain and company_name parameters.
pub fn find_email( &self, domain: &str, first_name: &str, middle_name: &str, last_name: &str, ) -> ZBResult<FindEmailResponse>
Use find_email_v2 instead. The new version supports both domain and company_name parameters.
Deprecated: Use find_email_v2 instead.
This function is kept for backward compatibility but will be removed in a future version.
Sourcepub fn find_email_v2(&self) -> FindEmailV2Builder<'_>
pub fn find_email_v2(&self) -> FindEmailV2Builder<'_>
Find an email address using either a domain or company name.
Returns a builder that allows you to set parameters using method chaining.
§Requirements
- Exactly one of
domainorcompany_namemust be provided (XOR requirement) first_nameis optional; without it the API answers with the domain’s address formats, the same asdomain_search_v2
§Example
use zero_bounce::ZeroBounce;
use zero_bounce::utility::ZBResult;
let zb = ZeroBounce::new("your_api_key");
// Using domain
let result = zb.find_email_v2()
.first_name("John")
.domain("example.com")
.last_name("Doe")
.call()?;
// Or using company name
let result = zb.find_email_v2()
.first_name("John")
.company_name("Example Inc")
.last_name("Doe")
.call()?;Sourcepub fn domain_search(&self, domain: &str) -> ZBResult<FindEmailResponse>
👎Deprecated since 1.2.0: Use domain_search_v2 instead. The new version supports both domain and company_name parameters.
pub fn domain_search(&self, domain: &str) -> ZBResult<FindEmailResponse>
Use domain_search_v2 instead. The new version supports both domain and company_name parameters.
Deprecated: Use domain_search_v2 instead.
This function is kept for backward compatibility but will be removed in a future version.
Sourcepub fn domain_search_v2(&self) -> DomainSearchV2Builder<'_>
pub fn domain_search_v2(&self) -> DomainSearchV2Builder<'_>
Search for email formats using either a domain or company name.
Returns a builder that allows you to set parameters using method chaining.
§Requirements
Exactly one of domain or company_name must be provided (XOR requirement).
§Example
use zero_bounce::ZeroBounce;
use zero_bounce::utility::ZBResult;
let zb = ZeroBounce::new("your_api_key");
// Using domain
let result = zb.domain_search_v2()
.domain("example.com")
.call()?;
// Or using company name
let result = zb.domain_search_v2()
.company_name("Example Inc")
.call()?;Source§impl ZeroBounce
impl ZeroBounce
Sourcepub fn new(api_key: &str) -> ZeroBounce
pub fn new(api_key: &str) -> ZeroBounce
Create a new ZeroBounce client instance with the default API URL.
§Arguments
api_key- Your ZeroBounce API key
§Example
use zero_bounce::ZeroBounce;
let zb = ZeroBounce::new("your_api_key");§Panics
When the HTTP client cannot be built (for example, the TLS backend
fails to initialise), as reqwest::blocking::Client::new() does.
with_base_url returns that as an error instead.
Sourcepub fn with_base_url<T>(api_key: &str, base_url: T) -> ZBResult<ZeroBounce>
pub fn with_base_url<T>(api_key: &str, base_url: T) -> ZBResult<ZeroBounce>
Create a new ZeroBounce client instance with a custom base URL.
§Arguments
api_key- Your ZeroBounce API keybase_url- Base URL. Can be:ApiBaseUrl::Default- Uses the default API URLApiBaseUrl::USA- Uses the USA API URLApiBaseUrl::EU- Uses the EU API URLStringor&str- Uses a custom URL string
§Errors
Returns ZBError::ExplicitError when base_url is not an https://
URL. http:// is accepted only for the exact hosts 127.0.0.1,
localhost and [::1], for local tests. Also when the HTTP client
cannot be built.
§Example
use zero_bounce::{ZeroBounce, ApiBaseUrl};
// Using enum
let zb = ZeroBounce::with_base_url("your_api_key", ApiBaseUrl::USA)?;
// Using custom string
let zb = ZeroBounce::with_base_url("your_api_key", "https://custom-api.example.com/v2/")?;