=begin #MailSlurp API #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository The version of the OpenAPI document: 6.5.2 Contact: contact@mailslurp.dev Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module MailSlurpClient class MissedEmailControllerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get all MissedEmails in paginated format # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [String] :inbox_id Optional inbox ID filter # @return [PageMissedEmailProjection] def get_all_missed_emails(opts = {}) data, _status_code, _headers = get_all_missed_emails_with_http_info(opts) data end # Get all MissedEmails in paginated format # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [String] :inbox_id Optional inbox ID filter # @return [Array<(PageMissedEmailProjection, Integer, Hash)>] PageMissedEmailProjection data, response status code and response headers def get_all_missed_emails_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MissedEmailControllerApi.get_all_missed_emails ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/missed-emails' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageMissedEmailProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MissedEmailControllerApi#get_all_missed_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all unknown missed emails in paginated format # Unknown missed emails are emails that were sent to MailSlurp but could not be assigned to an existing inbox. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [String] :inbox_id Optional inbox ID filter # @return [PageUnknownMissedEmailProjection] def get_all_unknown_missed_emails(opts = {}) data, _status_code, _headers = get_all_unknown_missed_emails_with_http_info(opts) data end # Get all unknown missed emails in paginated format # Unknown missed emails are emails that were sent to MailSlurp but could not be assigned to an existing inbox. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [String] :inbox_id Optional inbox ID filter # @return [Array<(PageUnknownMissedEmailProjection, Integer, Hash)>] PageUnknownMissedEmailProjection data, response status code and response headers def get_all_unknown_missed_emails_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MissedEmailControllerApi.get_all_unknown_missed_emails ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/missed-emails/unknown' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageUnknownMissedEmailProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MissedEmailControllerApi#get_all_unknown_missed_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get MissedEmail # @param missed_email_id [String] # @param [Hash] opts the optional parameters # @return [MissedEmail] def get_missed_email(missed_email_id, opts = {}) data, _status_code, _headers = get_missed_email_with_http_info(missed_email_id, opts) data end # Get MissedEmail # @param missed_email_id [String] # @param [Hash] opts the optional parameters # @return [Array<(MissedEmail, Integer, Hash)>] MissedEmail data, response status code and response headers def get_missed_email_with_http_info(missed_email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MissedEmailControllerApi.get_missed_email ...' end # verify the required parameter 'missed_email_id' is set if @api_client.config.client_side_validation && missed_email_id.nil? fail ArgumentError, "Missing the required parameter 'missed_email_id' when calling MissedEmailControllerApi.get_missed_email" end # resource path local_var_path = '/missed-emails/{missedEmailId}'.sub('{' + 'missedEmailId' + '}', CGI.escape(missed_email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'MissedEmail' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MissedEmailControllerApi#get_missed_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Wait for Nth missed email # Wait for 0 based index missed email # @param index [Integer] Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 # @param [Hash] opts the optional parameters # @option opts [String] :inbox_id Optional inbox ID filter # @option opts [Integer] :timeout Optional timeout milliseconds # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [MissedEmail] def wait_for_nth_missed_email(index, opts = {}) data, _status_code, _headers = wait_for_nth_missed_email_with_http_info(index, opts) data end # Wait for Nth missed email # Wait for 0 based index missed email # @param index [Integer] Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 # @param [Hash] opts the optional parameters # @option opts [String] :inbox_id Optional inbox ID filter # @option opts [Integer] :timeout Optional timeout milliseconds # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [Array<(MissedEmail, Integer, Hash)>] MissedEmail data, response status code and response headers def wait_for_nth_missed_email_with_http_info(index, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MissedEmailControllerApi.wait_for_nth_missed_email ...' end # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? fail ArgumentError, "Missing the required parameter 'index' when calling MissedEmailControllerApi.wait_for_nth_missed_email" end if @api_client.config.client_side_validation && index > 2147483647 fail ArgumentError, 'invalid value for "index" when calling MissedEmailControllerApi.wait_for_nth_missed_email, must be smaller than or equal to 2147483647.' end if @api_client.config.client_side_validation && index < 0 fail ArgumentError, 'invalid value for "index" when calling MissedEmailControllerApi.wait_for_nth_missed_email, must be greater than or equal to 0.' end # resource path local_var_path = '/missed-emails/waitForNthMissedEmail' # query parameters query_params = opts[:query_params] || {} query_params[:'index'] = index query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'MissedEmail' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MissedEmailControllerApi#wait_for_nth_missed_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end