MailSlurp::WaitForControllerApi

Load the API package

use MailSlurp::Object::WaitForControllerApi;

All URIs are relative to https://api.mailslurp.com

MethodHTTP requestDescription
wait_forPOST /waitForWait for an email to match the provided filter conditions such as subject contains keyword.
wait_for_email_countGET /waitForEmailCountWait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
wait_for_latest_emailGET /waitForLatestEmailFetch inbox’s latest email or if empty wait for an email to arrive
wait_for_matching_emailPOST /waitForMatchingEmailsWait or return list of emails that match simple matching patterns
wait_for_matching_first_emailPOST /waitForMatchingFirstEmailWait for or return the first email that matches provided MatchOptions array
wait_for_nth_emailGET /waitForNthEmailWait for or fetch the email with a given in the inbox specified. IF indx doesn’t exist waits for it to exist or timeout to occur.

wait_for

ARRAY[EmailPreview] wait_for(wait_for_conditions => $wait_for_conditions)

Wait for an email to match the provided filter conditions such as subject contains keyword.

Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $wait_for_conditions = MailSlurp::Object::WaitForConditions->new(); # WaitForConditions | Conditions to apply to emails that you are waiting for

eval { 
    my $result = $api_instance->wait_for(wait_for_conditions => $wait_for_conditions);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for: $@n";
}

Parameters

NameTypeDescriptionNotes
wait_for_conditionsWaitForConditionsConditions to apply to emails that you are waiting for[optional]

Return type

**ARRAY[EmailPreview]**

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]

wait_for_email_count

ARRAY[EmailPreview] wait_for_email_count(count => $count, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only)

Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs

If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $count = 56; # int | Number of emails to wait for. Must be greater that 1
my $inbox_id = null; # string | Id of the inbox we are fetching emails from
my $timeout = 789; # int | Max milliseconds to wait
my $unread_only = false; # boolean | Optional filter for unread only

eval { 
    my $result = $api_instance->wait_for_email_count(count => $count, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for_email_count: $@n";
}

Parameters

NameTypeDescriptionNotes
countintNumber of emails to wait for. Must be greater that 1[optional]
inbox_idstringId of the inbox we are fetching emails from[optional]
timeoutintMax milliseconds to wait[optional]
unread_onlybooleanOptional filter for unread only[optional] [default to false]

Return type

**ARRAY[EmailPreview]**

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]

wait_for_latest_email

Email wait_for_latest_email(inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only)

Fetch inbox’s latest email or if empty wait for an email to arrive

Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set unreadOnly=true or see the other receive methods such as waitForNthEmail or waitForEmailCount.

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $inbox_id = null; # string | Id of the inbox we are fetching emails from
my $timeout = 789; # int | Max milliseconds to wait
my $unread_only = false; # boolean | Optional filter for unread only.

eval { 
    my $result = $api_instance->wait_for_latest_email(inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for_latest_email: $@n";
}

Parameters

NameTypeDescriptionNotes
inbox_idstringId of the inbox we are fetching emails from[optional]
timeoutintMax milliseconds to wait[optional]
unread_onlybooleanOptional filter for unread only.[optional] [default to false]

Return type

Email

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]

wait_for_matching_email

ARRAY[EmailPreview] wait_for_matching_email(match_options => $match_options, count => $count, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only)

Wait or return list of emails that match simple matching patterns

Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the MatchOptions object for options. An example payload is { matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController getEmailContentMatch method.

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $match_options = MailSlurp::Object::MatchOptions->new(); # MatchOptions | matchOptions
my $count = 56; # int | Number of emails to wait for. Must be greater that 1
my $inbox_id = null; # string | Id of the inbox we are fetching emails from
my $timeout = 789; # int | Max milliseconds to wait
my $unread_only = false; # boolean | Optional filter for unread only

eval { 
    my $result = $api_instance->wait_for_matching_email(match_options => $match_options, count => $count, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for_matching_email: $@n";
}

Parameters

NameTypeDescriptionNotes
match_optionsMatchOptionsmatchOptions
countintNumber of emails to wait for. Must be greater that 1[optional]
inbox_idstringId of the inbox we are fetching emails from[optional]
timeoutintMax milliseconds to wait[optional]
unread_onlybooleanOptional filter for unread only[optional] [default to false]

Return type

**ARRAY[EmailPreview]**

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]

wait_for_matching_first_email

Email wait_for_matching_first_email(match_options => $match_options, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only)

Wait for or return the first email that matches provided MatchOptions array

Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the MatchOptions object for options. An example payload is { matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController getEmailContentMatch method.

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $match_options = MailSlurp::Object::MatchOptions->new(); # MatchOptions | matchOptions
my $inbox_id = null; # string | Id of the inbox we are matching an email for
my $timeout = 789; # int | Max milliseconds to wait
my $unread_only = false; # boolean | Optional filter for unread only

eval { 
    my $result = $api_instance->wait_for_matching_first_email(match_options => $match_options, inbox_id => $inbox_id, timeout => $timeout, unread_only => $unread_only);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for_matching_first_email: $@n";
}

Parameters

NameTypeDescriptionNotes
match_optionsMatchOptionsmatchOptions
inbox_idstringId of the inbox we are matching an email for[optional]
timeoutintMax milliseconds to wait[optional]
unread_onlybooleanOptional filter for unread only[optional] [default to false]

Return type

Email

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]

wait_for_nth_email

Email wait_for_nth_email(inbox_id => $inbox_id, => $, timeout => $timeout, unread_only => $unread_only)

Wait for or fetch the email with a given in the inbox specified. IF indx doesn’t exist waits for it to exist or timeout to occur.

If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.

Example

use Data::Dumper;
use MailSlurp::WaitForControllerApi;
my $api_instance = MailSlurp::WaitForControllerApi->new(

    # Configure API key authorization: API_KEY
    api_key => {'x-api-key' => 'YOUR_API_KEY'},
    # uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    #api_key_prefix => {'x-api-key' => 'Bearer'},
);

my $inbox_id = null; # string | Id of the inbox you are fetching emails from
my $ = 0; # int | Zero based  of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass =1
my $timeout = 789; # int | Max milliseconds to wait for the nth email if not already present
my $unread_only = false; # boolean | Optional filter for unread only

eval { 
    my $result = $api_instance->wait_for_nth_email(inbox_id => $inbox_id,  => $, timeout => $timeout, unread_only => $unread_only);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WaitForControllerApi->wait_for_nth_email: $@n";
}

Parameters

NameTypeDescriptionNotes
inbox_idstringId of the inbox you are fetching emails from[optional]
****intZero based of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass =1[optional] [default to 0]
timeoutintMax milliseconds to wait for the nth email if not already present[optional]
unread_onlybooleanOptional filter for unread only[optional] [default to false]

Return type

Email

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to ]