MailSlurpClient::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_emailsPOST /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 doesn’t exist waits for it to exist or timeout to occur.

wait_for

Array wait_for(opts)

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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
opts = {
  wait_for_conditions: MailSlurpClient::WaitForConditions.new # WaitForConditions | Conditions to apply to emails that you are waiting for
}

begin
  #Wait for an email to match the provided filter conditions such as subject contains keyword.
  result = api_instance.wait_for(opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for: #{e}"
end

Parameters

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

Return type

Array

Authorization

API_KEY

HTTP request headers

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

wait_for_email_count

Array wait_for_email_count(opts)

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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received before the given timestamp
  count: 56, # Integer | Number of emails to wait for. Must be greater that 1
  delay: 56, # Integer | Max milliseconds delay between calls
  inbox_id: 'inbox_id_example', # String | Id of the inbox we are fetching emails from
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received after the given timestamp
  sort: 'sort_example', # String | Sort direction
  timeout: 56, # Integer | Max milliseconds to wait
  unread_only: false # Boolean | Optional filter for unread only
}

begin
  #Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
  result = api_instance.wait_for_email_count(opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for_email_count: #{e}"
end

Parameters

NameTypeDescriptionNotes
beforeDateTimeFilter for emails that were received before the given timestamp[optional]
countIntegerNumber of emails to wait for. Must be greater that 1[optional]
delayIntegerMax milliseconds delay between calls[optional]
inbox_idStringId of the inbox we are fetching emails from[optional]
sinceDateTimeFilter for emails that were received after the given timestamp[optional]
sortStringSort direction[optional]
timeoutIntegerMax milliseconds to wait[optional]
unread_onlyBooleanOptional filter for unread only[optional] [default to false]

Return type

Array

Authorization

API_KEY

HTTP request headers

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

wait_for_latest_email

Email wait_for_latest_email(opts)

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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were before after the given timestamp
  delay: 56, # Integer | Max milliseconds delay between calls
  inbox_id: 'inbox_id_example', # String | Id of the inbox we are fetching emails from
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received after the given timestamp
  sort: 'sort_example', # String | Sort direction
  timeout: 56, # Integer | Max milliseconds to wait
  unread_only: false # Boolean | Optional filter for unread only.
}

begin
  #Fetch inbox's latest email or if empty wait for an email to arrive
  result = api_instance.wait_for_latest_email(opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for_latest_email: #{e}"
end

Parameters

NameTypeDescriptionNotes
beforeDateTimeFilter for emails that were before after the given timestamp[optional]
delayIntegerMax milliseconds delay between calls[optional]
inbox_idStringId of the inbox we are fetching emails from[optional]
sinceDateTimeFilter for emails that were received after the given timestamp[optional]
sortStringSort direction[optional]
timeoutIntegerMax 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

wait_for_matching_emails

Array wait_for_matching_emails(match_options, opts)

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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
match_options = MailSlurpClient::MatchOptions.new # MatchOptions | matchOptions
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received before the given timestamp
  count: 56, # Integer | Number of emails to wait for. Must be greater or equal to 1
  delay: 56, # Integer | Max milliseconds delay between calls
  inbox_id: 'inbox_id_example', # String | Id of the inbox we are fetching emails from
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received after the given timestamp
  sort: 'sort_example', # String | Sort direction
  timeout: 56, # Integer | Max milliseconds to wait
  unread_only: false # Boolean | Optional filter for unread only
}

begin
  #Wait or return list of emails that match simple matching patterns
  result = api_instance.wait_for_matching_emails(match_options, opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for_matching_emails: #{e}"
end

Parameters

NameTypeDescriptionNotes
match_optionsMatchOptionsmatchOptions
beforeDateTimeFilter for emails that were received before the given timestamp[optional]
countIntegerNumber of emails to wait for. Must be greater or equal to 1[optional]
delayIntegerMax milliseconds delay between calls[optional]
inbox_idStringId of the inbox we are fetching emails from[optional]
sinceDateTimeFilter for emails that were received after the given timestamp[optional]
sortStringSort direction[optional]
timeoutIntegerMax milliseconds to wait[optional]
unread_onlyBooleanOptional filter for unread only[optional] [default to false]

Return type

Array

Authorization

API_KEY

HTTP request headers

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

wait_for_matching_first_email

Email wait_for_matching_first_email(match_options, opts)

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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
match_options = MailSlurpClient::MatchOptions.new # MatchOptions | matchOptions
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received before the given timestamp
  delay: 56, # Integer | Max milliseconds delay between calls
  inbox_id: 'inbox_id_example', # String | Id of the inbox we are matching an email for
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received after the given timestamp
  sort: 'sort_example', # String | Sort direction
  timeout: 56, # Integer | Max milliseconds to wait
  unread_only: false # Boolean | Optional filter for unread only
}

begin
  #Wait for or return the first email that matches provided MatchOptions array
  result = api_instance.wait_for_matching_first_email(match_options, opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for_matching_first_email: #{e}"
end

Parameters

NameTypeDescriptionNotes
match_optionsMatchOptionsmatchOptions
beforeDateTimeFilter for emails that were received before the given timestamp[optional]
delayIntegerMax milliseconds delay between calls[optional]
inbox_idStringId of the inbox we are matching an email for[optional]
sinceDateTimeFilter for emails that were received after the given timestamp[optional]
sortStringSort direction[optional]
timeoutIntegerMax 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

wait_for_nth_email

Email wait_for_nth_email(opts)

Wait for or fetch the email with a given in the inbox specified. If 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

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::WaitForControllerApi.new
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received before the given timestamp
  delay: 56, # Integer | Max milliseconds delay between calls
  inbox_id: 'inbox_id_example', # String | Id of the inbox you are fetching emails from
  : 0, # Integer | 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
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter for emails that were received after the given timestamp
  sort: 'sort_example', # String | Sort direction
  timeout: 56, # Integer | Max milliseconds to wait for the nth email if not already present
  unread_only: false # Boolean | Optional filter for unread only
}

begin
  #Wait for or fetch the email with a given  in the inbox specified. If  doesn't exist waits for it to exist or timeout to occur.
  result = api_instance.wait_for_nth_email(opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling WaitForControllerApi->wait_for_nth_email: #{e}"
end

Parameters

NameTypeDescriptionNotes
beforeDateTimeFilter for emails that were received before the given timestamp[optional]
delayIntegerMax milliseconds delay between calls[optional]
inbox_idStringId of the inbox you are fetching emails from[optional]
****IntegerZero 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]
sinceDateTimeFilter for emails that were received after the given timestamp[optional]
sortStringSort direction[optional]
timeoutIntegerMax 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