MailValidationClient class
The main client for interacting with the TempMailBlocker email validation API.
This client provides methods to validate single emails and manage bulk validation jobs. All API requests require a valid API key which can be obtained from https://tempmailblocker.com.
Example:
final client = MailValidationClient(
apiKey: 'your-api-key',
baseUrl: 'https://tempmailblocker.com',
);
final result = await client.validateEmail('test@example.com');
print('Valid: ${result.isValid}');
Constructors
- MailValidationClient({required String apiKey, required String baseUrl, Duration timeout = const Duration(seconds: 30)})
- Creates a new MailValidationClient instance.
Properties
- apiKey → String
-
The API key used for authentication.
final
- baseUrl → String
-
The base URL of the TempMailBlocker API.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
The timeout duration for API requests.
final
Methods
-
createBulkJob(
{required List< String> emails, String? name}) → Future<BulkValidationJob> - Creates a bulk email validation job.
-
deleteJob(
String jobId) → Future< void> - Deletes a bulk validation job and all its results.
-
getJobResults(
String jobId) → Future< BulkValidationResult> - Gets the results of a completed bulk validation job.
-
getJobStatus(
String jobId) → Future< BulkValidationJob> - Gets the current status of a bulk validation job.
-
listJobs(
{int limit = 10, int page = 1}) → Future< List< BulkValidationJob> > - Lists all bulk validation jobs for the authenticated user.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateEmail(
String email) → Future< SingleValidationResponse> - Validates a single email address.
-
waitForJobCompletion(
String jobId, {Duration pollInterval = const Duration(seconds: 5), Duration timeout = const Duration(minutes: 5)}) → Future< BulkValidationResult> - Waits for a bulk validation job to complete and returns the results.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited