pub struct BriteVerifyClient { /* private fields */ }Expand description
Implementations§
Source§impl BriteVerifyClient
impl BriteVerifyClient
Sourcepub fn new<ApiKey: ToString>(
api_key: ApiKey,
) -> Result<Self, BriteVerifyClientError>
pub fn new<ApiKey: ToString>( api_key: ApiKey, ) -> Result<Self, BriteVerifyClientError>
Create a new BriteVerifyClient instance
§Example
let client: BriteVerifyClient = BriteVerifyClient::new("YOUR API KEY")?;Sourcepub fn builder() -> BriteVerifyClientBuilder
pub fn builder() -> BriteVerifyClientBuilder
Create a new builder to incrementally
build a BriteVerifyClient with a customised
configuration
§Example
let builder: BriteVerifyClientBuilder = BriteVerifyClient::builder();
// ... call various builder methods
let client: BriteVerifyClient = builder.build()?;Sourcepub async fn current_credits(&self) -> Result<u32>
pub async fn current_credits(&self) -> Result<u32>
Sourcepub async fn current_credits_in_reserve(&self) -> Result<u32>
pub async fn current_credits_in_reserve(&self) -> Result<u32>
Sourcepub async fn get_account_balance(
&self,
) -> Result<AccountCreditBalance, BriteVerifyClientError>
pub async fn get_account_balance( &self, ) -> Result<AccountCreditBalance, BriteVerifyClientError>
Sourcepub async fn verify_contact<EmailAddress: ToString + Debug, PhoneNumber: ToString + Debug, AddressLine1: ToString + Debug, AddressLine2: ToString + Debug, CityName: ToString + Debug, StateNameOrAbbr: ToString + Debug, ZipCode: ToString + Debug>(
&self,
email: EmailAddress,
phone: PhoneNumber,
address1: AddressLine1,
address2: Option<AddressLine2>,
city: CityName,
state: StateNameOrAbbr,
zip: ZipCode,
) -> Result<VerificationResponse, BriteVerifyClientError>
pub async fn verify_contact<EmailAddress: ToString + Debug, PhoneNumber: ToString + Debug, AddressLine1: ToString + Debug, AddressLine2: ToString + Debug, CityName: ToString + Debug, StateNameOrAbbr: ToString + Debug, ZipCode: ToString + Debug>( &self, email: EmailAddress, phone: PhoneNumber, address1: AddressLine1, address2: Option<AddressLine2>, city: CityName, state: StateNameOrAbbr, zip: ZipCode, ) -> Result<VerificationResponse, BriteVerifyClientError>
Sourcepub async fn verify_email<EmailAddress: ToString + Debug>(
&self,
email: EmailAddress,
) -> Result<EmailVerificationArray, BriteVerifyClientError>
pub async fn verify_email<EmailAddress: ToString + Debug>( &self, email: EmailAddress, ) -> Result<EmailVerificationArray, BriteVerifyClientError>
Sourcepub async fn verify_phone_number<PhoneNumber: ToString + Debug>(
&self,
phone: PhoneNumber,
) -> Result<PhoneNumberVerificationArray, BriteVerifyClientError>
pub async fn verify_phone_number<PhoneNumber: ToString + Debug>( &self, phone: PhoneNumber, ) -> Result<PhoneNumberVerificationArray, BriteVerifyClientError>
Sourcepub async fn verify_street_address<AddressLine1: ToString + Debug, AddressLine2: ToString + Debug, CityName: ToString + Debug, StateNameOrAbbr: ToString + Debug, ZipCode: ToString + Debug>(
&self,
address1: AddressLine1,
address2: Option<AddressLine2>,
city: CityName,
state: StateNameOrAbbr,
zip: ZipCode,
) -> Result<AddressVerificationArray, BriteVerifyClientError>
pub async fn verify_street_address<AddressLine1: ToString + Debug, AddressLine2: ToString + Debug, CityName: ToString + Debug, StateNameOrAbbr: ToString + Debug, ZipCode: ToString + Debug>( &self, address1: AddressLine1, address2: Option<AddressLine2>, city: CityName, state: StateNameOrAbbr, zip: ZipCode, ) -> Result<AddressVerificationArray, BriteVerifyClientError>
Sourcepub async fn get_lists(
&self,
) -> Result<GetListStatesResponse, BriteVerifyClientError>
pub async fn get_lists( &self, ) -> Result<GetListStatesResponse, BriteVerifyClientError>
Sourcepub async fn get_filtered_lists<'header, Date: Datelike + Debug, Page: Into<u32> + Debug, State: Clone + Debug + Into<BatchState>, ExternalId: Display + Debug>(
&self,
page: Option<Page>,
date: Option<Date>,
state: Option<State>,
ext_id: Option<ExternalId>,
) -> Result<GetListStatesResponse, BriteVerifyClientError>
pub async fn get_filtered_lists<'header, Date: Datelike + Debug, Page: Into<u32> + Debug, State: Clone + Debug + Into<BatchState>, ExternalId: Display + Debug>( &self, page: Option<Page>, date: Option<Date>, state: Option<State>, ext_id: Option<ExternalId>, ) -> Result<GetListStatesResponse, BriteVerifyClientError>
Retrieve the complete list of all bulk verification lists created within the last 7 calendar days filtered by the specified criteria [ref]
§Example
use chrono::{NaiveDate, Utc};
use briteverify_rs::{BriteVerifyClient, types::GetListStatesResponse};
let today: NaiveDate = Utc::now().date_naive();
let page: Option<u32> = Some(5u32);
let state: Option<&str> = Some("open");
let date: Option<NaiveDate> = today.with_day(today.day() - 2);
let ext_id: Option<&str> = None;
let lists: GetListStatesResponse = client.get_filtered_lists(page, date, state, ext_id).await?;
println!("Filtered bulk verification lists: {lists:#?}");Sourcepub async fn get_lists_by_date<Date: Datelike + Debug>(
&self,
date: Date,
) -> Result<GetListStatesResponse, BriteVerifyClientError>
pub async fn get_lists_by_date<Date: Datelike + Debug>( &self, date: Date, ) -> Result<GetListStatesResponse, BriteVerifyClientError>
Retrieve the complete list of all bulk verification lists filtered by the specified date [ref]
NOTE: Regardless of specified date, the BriteVerify API does not appear to persist bulk verification lists older than 7 calendar days
§Example
use chrono::{NaiveDate, Utc};
use briteverify_rs::{BriteVerifyClient, types::GetListStatesResponse};
let today: NaiveDate = Utc::now().date_naive();
let date: NaiveDate = today.with_day(today.day() - 2).unwrap();
let lists: GetListStatesResponse = client.get_lists_by_date(date.clone()).await?;
println!("Bulk verification lists for '{date}': {lists:#?}");Sourcepub async fn get_lists_by_page<Page: Into<u32> + Debug>(
&self,
page: Page,
) -> Result<GetListStatesResponse, BriteVerifyClientError>
pub async fn get_lists_by_page<Page: Into<u32> + Debug>( &self, page: Page, ) -> Result<GetListStatesResponse, BriteVerifyClientError>
Sourcepub async fn get_lists_by_state(
&self,
state: BatchState,
) -> Result<GetListStatesResponse, BriteVerifyClientError>
pub async fn get_lists_by_state( &self, state: BatchState, ) -> Result<GetListStatesResponse, BriteVerifyClientError>
Retrieve the complete list of all bulk verification lists created within the last 7 calendar days whose status matches the specified value [ref]
§Example
use briteverify_rs::{BriteVerifyClient, types::{BatchState, GetListStatesResponse}};
let state: BatchState = BatchState::Closed;
let lists: GetListStatesResponse = client.get_lists_by_state(state).await?;
println!("Bulk verification lists w/ state '{state}': {lists:#?}");Sourcepub async fn create_list<Contact: Into<VerificationRequest> + Debug, ContactCollection: IntoIterator<Item = Contact> + Debug>(
&self,
contacts: Option<ContactCollection>,
auto_start: bool,
) -> Result<CreateListResponse, BriteVerifyClientError>
pub async fn create_list<Contact: Into<VerificationRequest> + Debug, ContactCollection: IntoIterator<Item = Contact> + Debug>( &self, contacts: Option<ContactCollection>, auto_start: bool, ) -> Result<CreateListResponse, BriteVerifyClientError>
Create a new bulk verification list with the supplied records and (optionally) queue it for immediate processing [ref]
§Examples
§Create Empty List
use briteverify_rs::types::{CreateListResponse, VerificationRequest};
let contacts = <Option<Vec<VerificationRequest>>>::None;
let list: CreateListResponse = client.create_list(contacts, false).await?;
println!("New bulk verification list: {list:#?}");§Create Populated List & Start Immediately
use briteverify_rs::{
types::{
CreateListResponse,
VerificationRequest,
},
};
let contacts: [VerificationRequest; 2] = [
VerificationRequest::try_from("test@example.com")?,
VerificationRequest::try_from("+15555555555")?
];
let list: CreateListResponse = client.create_list(Some(contacts), true).await?;
println!("New bulk verification list: {list:#?}");Sourcepub async fn update_list<ListId: ToString + Debug, Contact: Into<VerificationRequest> + Debug, ContactCollection: IntoIterator<Item = Contact> + Debug>(
&self,
list_id: ListId,
contacts: ContactCollection,
auto_start: bool,
) -> Result<UpdateListResponse, BriteVerifyClientError>
pub async fn update_list<ListId: ToString + Debug, Contact: Into<VerificationRequest> + Debug, ContactCollection: IntoIterator<Item = Contact> + Debug>( &self, list_id: ListId, contacts: ContactCollection, auto_start: bool, ) -> Result<UpdateListResponse, BriteVerifyClientError>
Append records to the specified bulk verification list and (optionally) queue it for immediate processing [ref]
§Example
use briteverify_rs::{
types::{
UpdateListResponse,
VerificationRequest,
},
};
let contacts: [VerificationRequest; 2] = [
VerificationRequest::try_from("some-email@bounce-me.net")?,
VerificationRequest::try_from("another-email@a-real-domain.org")?,
];
let list: UpdateListResponse = client.update_list("some-list-id", contacts, false).await?;
println!("Updated bulk verification list: {list:#?}");Sourcepub async fn get_list_by_id<ListId: ToString + Debug>(
&self,
list_id: ListId,
) -> Result<VerificationListState, BriteVerifyClientError>
pub async fn get_list_by_id<ListId: ToString + Debug>( &self, list_id: ListId, ) -> Result<VerificationListState, BriteVerifyClientError>
Sourcepub async fn get_list_by_external_id<ListId: ToString + Debug, ExternalId: Display + Debug>(
&self,
list_id: ListId,
external_id: ExternalId,
) -> Result<VerificationListState, BriteVerifyClientError>
pub async fn get_list_by_external_id<ListId: ToString + Debug, ExternalId: Display + Debug>( &self, list_id: ListId, external_id: ExternalId, ) -> Result<VerificationListState, BriteVerifyClientError>
Retrieve current “state” of a bulk verification list tied to an externally supplied / customer-specific identifier [ref]
§Example
use briteverify_rs::types::VerificationListState;
let list_id: &str = "some-list-id";
let customer_id: &str = "some-customer-id";
let list: VerificationListState = client.get_list_by_external_id(list_id, customer_id).await?;
println!("Bulk verification list '{list_id}': {list:#?}");Sourcepub async fn delete_list_by_id<ListId: ToString + Debug>(
&self,
list_id: ListId,
) -> Result<DeleteListResponse, BriteVerifyClientError>
pub async fn delete_list_by_id<ListId: ToString + Debug>( &self, list_id: ListId, ) -> Result<DeleteListResponse, BriteVerifyClientError>
Delete the specified batch verification list [ref]
NOTE: This action cannot be reversed and once completed, the list will no longer exist. The list must be in one of the following states to be deleted:
§Example
use briteverify_rs::types::DeleteListResponse;
let list_id: &str = "some-list-id";
let response: DeleteListResponse = client.delete_list_by_id(list_id).await?;
println!("Bulk verification list '{list_id}' final state: {response:#?}");Sourcepub async fn terminate_list_by_id<ListId: ToString + Debug>(
&self,
list_id: ListId,
) -> Result<UpdateListResponse, BriteVerifyClientError>
pub async fn terminate_list_by_id<ListId: ToString + Debug>( &self, list_id: ListId, ) -> Result<UpdateListResponse, BriteVerifyClientError>
Abandon the specified unprocessed bulk verification list [ref]
NOTE: This action is only applicable to lists
that have not yet begun processing. For any list
that has already been “started”, the equivalent
action would be delete_list_by_id.
§Example
use briteverify_rs::types::UpdateListResponse;
let list_id: &str = "some-list-id";
let response: UpdateListResponse = client.terminate_list_by_id(list_id).await?;
println!("Bulk verification list '{list_id}' final state: {response:#?}");Sourcepub async fn queue_list_for_processing<ListId: ToString + Debug>(
&self,
list_id: ListId,
) -> Result<UpdateListResponse, BriteVerifyClientError>
pub async fn queue_list_for_processing<ListId: ToString + Debug>( &self, list_id: ListId, ) -> Result<UpdateListResponse, BriteVerifyClientError>
Queue the specified (open) bulk verification list for immediate processing [ref]
§Example
use briteverify_rs::types::UpdateListResponse;
let list_id: &str = "some-list-id";
let response: UpdateListResponse = client.queue_list_for_processing(list_id).await?;
println!("Bulk verification list '{list_id}' state: {response:#?}");Sourcepub async fn get_results_by_list_id<ListId: ToString + Debug>(
&self,
list_id: ListId,
) -> Result<Vec<BulkVerificationResult>, BriteVerifyClientError>
pub async fn get_results_by_list_id<ListId: ToString + Debug>( &self, list_id: ListId, ) -> Result<Vec<BulkVerificationResult>, BriteVerifyClientError>
Get the verification results for the specified bulk verification list [ref]
NOTE: Verification results are only available once a list has finished verifying in its entirety. It is not possible to retrieve verification results piecemeal.
§Example
use briteverify_rs::types::BulkVerificationResult;
let list_id: &str = "some-list-id";
let data: Vec<BulkVerificationResult> = client.get_results_by_list_id(list_id).await?;
println!("Bulk verification list '{list_id}' results: {data:#?}");Methods from Deref<Target = Client>§
Sourcepub fn get<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn get<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a GET request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn post<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn post<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a POST request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn put<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn put<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a PUT request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn patch<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn patch<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a PATCH request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn delete<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn delete<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a DELETE request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn head<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn head<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a HEAD request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn request<U>(&self, method: Method, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn request<U>(&self, method: Method, url: U) -> RequestBuilderwhere
U: IntoUrl,
Start building a Request with the Method and Url.
Returns a RequestBuilder, which will allow setting headers and
the request body before sending.
§Errors
This method fails whenever the supplied Url cannot be parsed.
Sourcepub fn execute(
&self,
request: Request,
) -> impl Future<Output = Result<Response, Error>>
pub fn execute( &self, request: Request, ) -> impl Future<Output = Result<Response, Error>>
Executes a Request.
A Request can be built manually with Request::new() or obtained
from a RequestBuilder with RequestBuilder::build().
You should prefer to use the RequestBuilder and
RequestBuilder::send().
§Errors
This method fails if there was an error while sending request, redirect loop was detected or redirect limit was exhausted.
Trait Implementations§
Source§impl Debug for BriteVerifyClient
impl Debug for BriteVerifyClient
Source§impl Deref for BriteVerifyClient
impl Deref for BriteVerifyClient
Auto Trait Implementations§
impl Freeze for BriteVerifyClient
impl !RefUnwindSafe for BriteVerifyClient
impl Send for BriteVerifyClient
impl Sync for BriteVerifyClient
impl Unpin for BriteVerifyClient
impl !UnwindSafe for BriteVerifyClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more