maislurp-client-powershell.maislurp-client-powershell/Api.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-ForEmailCountGET /waitForEmailCountWait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
Wait-ForLatestEmailGET /waitForLatestEmailFetch inbox’s latest email or if empty wait for an email to arrive
Wait-ForMatchingEmailsPOST /waitForMatchingEmailsWait or return list of emails that match simple matching patterns
Wait-ForMatchingFirstEmailPOST /waitForMatchingFirstEmailWait for or return the first email that matches provided MatchOptions array
Wait-ForNthEmailGET /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

EmailPreview[] Wait-For         [-WaitForConditions]

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$WaitForConditions = (Initialize-WaitForConditions -Before Get-Date -Count 123 -CountType "EXACTLY" -DelayTimeout 123 -InboxId "InboxId_example" -VarMatches @((Initialize-MatchOption -Field "SUBJECT" -Should "CONTAIN" -Value "Value_example")) -Since Get-Date -SortDirection "ASC" -Timeout 123 -UnreadOnly $false) # WaitForConditions | Conditions to apply to emails that you are waiting for (optional)

# Wait for an email to match the provided filter conditions such as subject contains keyword.
try {
     $Result = Wait-For -WaitForConditions $WaitForConditions
} catch {
    Write-Host ("Exception occured when calling Wait-For: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

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

Return type

**EmailPreview[]** (PSCustomObject)

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-ForEmailCount

EmailPreview[] Wait-ForEmailCount         [-Before] <System.Nullable[System.DateTime]>         [-Count] <System.Nullable[Int32]>         [-Delay] <System.Nullable[Int64]>         [-InboxId]         [-Since] <System.Nullable[System.DateTime]>         [-Sort]         [-Timeout] <System.Nullable[Int64]>         [-UnreadOnly] <System.Nullable[Boolean]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$Before = Get-Date # System.DateTime | Filter for emails that were received before the given timestamp (optional)
$Count = 987 # Int32 | Number of emails to wait for. Must be greater that 1 (optional)
$Delay = 987 # Int64 | Max milliseconds delay between calls (optional)
$InboxId = "InboxId_example" # String | Id of the inbox we are fetching emails from (optional)
$Since = Get-Date # System.DateTime | Filter for emails that were received after the given timestamp (optional)
$Sort = "ASC" # String | Sort direction (optional)
$Timeout = 987 # Int64 | Max milliseconds to wait (optional)
$UnreadOnly = true # Boolean | Optional filter for unread only (optional) (default to $false)

# Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
try {
     $Result = Wait-ForEmailCount -Before $Before -Count $Count -Delay $Delay -InboxId $InboxId -Since $Since -Sort $Sort -Timeout $Timeout -UnreadOnly $UnreadOnly
} catch {
    Write-Host ("Exception occured when calling Wait-ForEmailCount: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
BeforeSystem.DateTimeFilter for emails that were received before the given timestamp[optional]
CountInt32Number of emails to wait for. Must be greater that 1[optional]
DelayInt64Max milliseconds delay between calls[optional]
InboxIdStringId of the inbox we are fetching emails from[optional]
SinceSystem.DateTimeFilter for emails that were received after the given timestamp[optional]
SortStringSort direction[optional]
TimeoutInt64Max milliseconds to wait[optional]
UnreadOnlyBooleanOptional filter for unread only[optional] [default to $false]

Return type

**EmailPreview[]** (PSCustomObject)

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-ForLatestEmail

Email Wait-ForLatestEmail         [-Before] <System.Nullable[System.DateTime]>         [-Delay] <System.Nullable[Int64]>         [-InboxId]         [-Since] <System.Nullable[System.DateTime]>         [-Sort]         [-Timeout] <System.Nullable[Int64]>         [-UnreadOnly] <System.Nullable[Boolean]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$Before = Get-Date # System.DateTime | Filter for emails that were before after the given timestamp (optional)
$Delay = 987 # Int64 | Max milliseconds delay between calls (optional)
$InboxId = "InboxId_example" # String | Id of the inbox we are fetching emails from (optional)
$Since = Get-Date # System.DateTime | Filter for emails that were received after the given timestamp (optional)
$Sort = "ASC" # String | Sort direction (optional)
$Timeout = 987 # Int64 | Max milliseconds to wait (optional)
$UnreadOnly = true # Boolean | Optional filter for unread only. (optional) (default to $false)

# Fetch inbox's latest email or if empty wait for an email to arrive
try {
     $Result = Wait-ForLatestEmail -Before $Before -Delay $Delay -InboxId $InboxId -Since $Since -Sort $Sort -Timeout $Timeout -UnreadOnly $UnreadOnly
} catch {
    Write-Host ("Exception occured when calling Wait-ForLatestEmail: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
BeforeSystem.DateTimeFilter for emails that were before after the given timestamp[optional]
DelayInt64Max milliseconds delay between calls[optional]
InboxIdStringId of the inbox we are fetching emails from[optional]
SinceSystem.DateTimeFilter for emails that were received after the given timestamp[optional]
SortStringSort direction[optional]
TimeoutInt64Max milliseconds to wait[optional]
UnreadOnlyBooleanOptional filter for unread only.[optional] [default to $false]

Return type

Email (PSCustomObject)

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-ForMatchingEmails

EmailPreview[] Wait-ForMatchingEmails         [-MatchOptions]         [-Before] <System.Nullable[System.DateTime]>         [-Count] <System.Nullable[Int32]>         [-Delay] <System.Nullable[Int64]>         [-InboxId]         [-Since] <System.Nullable[System.DateTime]>         [-Sort]         [-Timeout] <System.Nullable[Int64]>         [-UnreadOnly] <System.Nullable[Boolean]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$MatchOptions = (Initialize-MatchOptions -Conditions @((Initialize-ConditionOption -Condition "HAS_ATTACHMENTS" -Value "TRUE")) -VarMatches @((Initialize-MatchOption -Field "SUBJECT" -Should "CONTAIN" -Value "Value_example"))) # MatchOptions | matchOptions
$Before = Get-Date # System.DateTime | Filter for emails that were received before the given timestamp (optional)
$Count = 987 # Int32 | Number of emails to wait for. Must be greater or equal to 1 (optional)
$Delay = 987 # Int64 | Max milliseconds delay between calls (optional)
$InboxId = "InboxId_example" # String | Id of the inbox we are fetching emails from (optional)
$Since = Get-Date # System.DateTime | Filter for emails that were received after the given timestamp (optional)
$Sort = "ASC" # String | Sort direction (optional)
$Timeout = 987 # Int64 | Max milliseconds to wait (optional)
$UnreadOnly = true # Boolean | Optional filter for unread only (optional) (default to $false)

# Wait or return list of emails that match simple matching patterns
try {
     $Result = Wait-ForMatchingEmails -MatchOptions $MatchOptions -Before $Before -Count $Count -Delay $Delay -InboxId $InboxId -Since $Since -Sort $Sort -Timeout $Timeout -UnreadOnly $UnreadOnly
} catch {
    Write-Host ("Exception occured when calling Wait-ForMatchingEmails: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
MatchOptionsMatchOptionsmatchOptions
BeforeSystem.DateTimeFilter for emails that were received before the given timestamp[optional]
CountInt32Number of emails to wait for. Must be greater or equal to 1[optional]
DelayInt64Max milliseconds delay between calls[optional]
InboxIdStringId of the inbox we are fetching emails from[optional]
SinceSystem.DateTimeFilter for emails that were received after the given timestamp[optional]
SortStringSort direction[optional]
TimeoutInt64Max milliseconds to wait[optional]
UnreadOnlyBooleanOptional filter for unread only[optional] [default to $false]

Return type

**EmailPreview[]** (PSCustomObject)

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-ForMatchingFirstEmail

Email Wait-ForMatchingFirstEmail         [-MatchOptions]         [-Before] <System.Nullable[System.DateTime]>         [-Delay] <System.Nullable[Int64]>         [-InboxId]         [-Since] <System.Nullable[System.DateTime]>         [-Sort]         [-Timeout] <System.Nullable[Int64]>         [-UnreadOnly] <System.Nullable[Boolean]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$MatchOptions = (Initialize-MatchOptions -Conditions @((Initialize-ConditionOption -Condition "HAS_ATTACHMENTS" -Value "TRUE")) -VarMatches @()) # MatchOptions | matchOptions
$Before = Get-Date # System.DateTime | Filter for emails that were received before the given timestamp (optional)
$Delay = 987 # Int64 | Max milliseconds delay between calls (optional)
$InboxId = "InboxId_example" # String | Id of the inbox we are matching an email for (optional)
$Since = Get-Date # System.DateTime | Filter for emails that were received after the given timestamp (optional)
$Sort = "ASC" # String | Sort direction (optional)
$Timeout = 987 # Int64 | Max milliseconds to wait (optional)
$UnreadOnly = true # Boolean | Optional filter for unread only (optional) (default to $false)

# Wait for or return the first email that matches provided MatchOptions array
try {
     $Result = Wait-ForMatchingFirstEmail -MatchOptions $MatchOptions -Before $Before -Delay $Delay -InboxId $InboxId -Since $Since -Sort $Sort -Timeout $Timeout -UnreadOnly $UnreadOnly
} catch {
    Write-Host ("Exception occured when calling Wait-ForMatchingFirstEmail: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
MatchOptionsMatchOptionsmatchOptions
BeforeSystem.DateTimeFilter for emails that were received before the given timestamp[optional]
DelayInt64Max milliseconds delay between calls[optional]
InboxIdStringId of the inbox we are matching an email for[optional]
SinceSystem.DateTimeFilter for emails that were received after the given timestamp[optional]
SortStringSort direction[optional]
TimeoutInt64Max milliseconds to wait[optional]
UnreadOnlyBooleanOptional filter for unread only[optional] [default to $false]

Return type

Email (PSCustomObject)

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-ForNthEmail

Email Wait-ForNthEmail         [-Before] <System.Nullable[System.DateTime]>         [-Delay] <System.Nullable[Int64]>         [-InboxId]         [-Index] <System.Nullable[Int32]>         [-Since] <System.Nullable[System.DateTime]>         [-Sort]         [-Timeout] <System.Nullable[Int64]>         [-UnreadOnly] <System.Nullable[Boolean]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$Before = Get-Date # System.DateTime | Filter for emails that were received before the given timestamp (optional)
$Delay = 987 # Int64 | Max milliseconds delay between calls (optional)
$InboxId = "InboxId_example" # String | Id of the inbox you are fetching emails from (optional)
$Index = 987 # Int32 | 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 (optional) (default to 0)
$Since = Get-Date # System.DateTime | Filter for emails that were received after the given timestamp (optional)
$Sort = "ASC" # String | Sort direction (optional)
$Timeout = 987 # Int64 | Max milliseconds to wait for the nth email if not already present (optional)
$UnreadOnly = true # Boolean | Optional filter for unread only (optional) (default to $false)

# 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.
try {
     $Result = Wait-ForNthEmail -Before $Before -Delay $Delay -InboxId $InboxId -Index $Index -Since $Since -Sort $Sort -Timeout $Timeout -UnreadOnly $UnreadOnly
} catch {
    Write-Host ("Exception occured when calling Wait-ForNthEmail: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
BeforeSystem.DateTimeFilter for emails that were received before the given timestamp[optional]
DelayInt64Max milliseconds delay between calls[optional]
InboxIdStringId of the inbox you are fetching emails from[optional]
IndexInt32Zero 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]
SinceSystem.DateTimeFilter for emails that were received after the given timestamp[optional]
SortStringSort direction[optional]
TimeoutInt64Max milliseconds to wait for the nth email if not already present[optional]
UnreadOnlyBooleanOptional filter for unread only[optional] [default to $false]

Return type

Email (PSCustomObject)

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 ]