# \WaitForControllerApi
All URIs are relative to *https://api.mailslurp.com*
[**wait_for**](WaitForControllerApi.md#wait_for) | **Post** /waitFor | Wait for conditions to be met
[**wait_for_email_count**](WaitForControllerApi.md#wait_for_email_count) | **Get** /waitForEmailCount | Wait for and return count number of emails
[**wait_for_latest_email**](WaitForControllerApi.md#wait_for_latest_email) | **Get** /waitForLatestEmail | Fetch inbox's latest email or if empty wait for an email to arrive
[**wait_for_matching_email**](WaitForControllerApi.md#wait_for_matching_email) | **Post** /waitForMatchingEmails | Wait or return list of emails that match simple matching patterns
[**wait_for_nth_email**](WaitForControllerApi.md#wait_for_nth_email) | **Get** /waitForNthEmail | Wait for or fetch the email with a given index in the inbox specified
## wait_for
> Vec<crate::models::EmailPreview> wait_for(wait_for_conditions)
Wait for conditions to be met
Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met
### Parameters
**wait_for_conditions** | Option<[**WaitForConditions**](WaitForConditions.md)> | Conditions to wait for | |
### Return type
[**Vec<crate::models::EmailPreview>**](EmailPreview.md)
### Authorization
[API_KEY](../README.md#API_KEY)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## wait_for_email_count
> Vec<crate::models::EmailPreview> wait_for_email_count(count, inbox_id, timeout, unread_only)
Wait for and return count number of emails
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.
### Parameters
**count** | Option<**i32**> | Number of emails to wait for. Must be greater that 1 | |
**inbox_id** | Option<[**String**](.md)> | Id of the inbox we are fetching emails from | |
**timeout** | Option<**i64**> | Max milliseconds to wait | |
**unread_only** | Option<**bool**> | Optional filter for unread only | |[default to false]
### Return type
[**Vec<crate::models::EmailPreview>**](EmailPreview.md)
### Authorization
[API_KEY](../README.md#API_KEY)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## wait_for_latest_email
> crate::models::Email wait_for_latest_email(inbox_id, timeout, 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`.
### Parameters
**inbox_id** | Option<[**String**](.md)> | Id of the inbox we are fetching emails from | |
**timeout** | Option<**i64**> | Max milliseconds to wait | |
**unread_only** | Option<**bool**> | Optional filter for unread only. | |[default to false]
### Return type
[**crate::models::Email**](Email.md)
### Authorization
[API_KEY](../README.md#API_KEY)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## wait_for_matching_email
> Vec<crate::models::EmailPreview> wait_for_matching_email(match_options, count, inbox_id, timeout, 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.
### Parameters
**match_options** | [**MatchOptions**](MatchOptions.md) | matchOptions | [required] |
**count** | Option<**i32**> | Number of emails to wait for. Must be greater that 1 | |
**inbox_id** | Option<[**String**](.md)> | Id of the inbox we are fetching emails from | |
**timeout** | Option<**i64**> | Max milliseconds to wait | |
**unread_only** | Option<**bool**> | Optional filter for unread only | |[default to false]
### Return type
[**Vec<crate::models::EmailPreview>**](EmailPreview.md)
### Authorization
[API_KEY](../README.md#API_KEY)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## wait_for_nth_email
> crate::models::Email wait_for_nth_email(inbox_id, index, timeout, unread_only)
Wait for or fetch the email with a given index in the inbox specified
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.
### Parameters
**inbox_id** | Option<[**String**](.md)> | Id of the inbox you are fetching emails from | |
**index** | Option<**i32**> | Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 | |[default to 0]
**timeout** | Option<**i64**> | Max milliseconds to wait for the nth email if not already present | |
**unread_only** | Option<**bool**> | Optional filter for unread only | |[default to false]
### Return type
[**crate::models::Email**](Email.md)
### Authorization
[API_KEY](../README.md#API_KEY)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)