=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 BounceControllerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Filter a list of email recipients and remove those who have bounced # Prevent email sending errors by remove recipients who have resulted in past email bounces or complaints # @param filter_bounced_recipients_options [FilterBouncedRecipientsOptions] # @param [Hash] opts the optional parameters # @return [FilterBouncedRecipientsResult] def filter_bounced_recipient(filter_bounced_recipients_options, opts = {}) data, _status_code, _headers = filter_bounced_recipient_with_http_info(filter_bounced_recipients_options, opts) data end # Filter a list of email recipients and remove those who have bounced # Prevent email sending errors by remove recipients who have resulted in past email bounces or complaints # @param filter_bounced_recipients_options [FilterBouncedRecipientsOptions] # @param [Hash] opts the optional parameters # @return [Array<(FilterBouncedRecipientsResult, Integer, Hash)>] FilterBouncedRecipientsResult data, response status code and response headers def filter_bounced_recipient_with_http_info(filter_bounced_recipients_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.filter_bounced_recipient ...' end # verify the required parameter 'filter_bounced_recipients_options' is set if @api_client.config.client_side_validation && filter_bounced_recipients_options.nil? fail ArgumentError, "Missing the required parameter 'filter_bounced_recipients_options' when calling BounceControllerApi.filter_bounced_recipient" end # resource path local_var_path = '/bounce/filter-recipients' # 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(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(filter_bounced_recipients_options) # return_type return_type = opts[:return_type] || 'FilterBouncedRecipientsResult' # 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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BounceControllerApi#filter_bounced_recipient\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a bounced email. # Bounced emails are email you have sent that were rejected by a recipient # @param id [String] ID of the bounced email to fetch # @param [Hash] opts the optional parameters # @return [BouncedEmailDto] def get_bounced_email(id, opts = {}) data, _status_code, _headers = get_bounced_email_with_http_info(id, opts) data end # Get a bounced email. # Bounced emails are email you have sent that were rejected by a recipient # @param id [String] ID of the bounced email to fetch # @param [Hash] opts the optional parameters # @return [Array<(BouncedEmailDto, Integer, Hash)>] BouncedEmailDto data, response status code and response headers def get_bounced_email_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.get_bounced_email ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling BounceControllerApi.get_bounced_email" end # resource path local_var_path = '/bounce/emails/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'BouncedEmailDto' # 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: BounceControllerApi#get_bounced_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get paginated list of bounced emails. # Bounced emails are email you have sent that were rejected by a recipient # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index (default to 0) # @option opts [Integer] :size Optional page size (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @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 [PageBouncedEmail] def get_bounced_emails(opts = {}) data, _status_code, _headers = get_bounced_emails_with_http_info(opts) data end # Get paginated list of bounced emails. # Bounced emails are email you have sent that were rejected by a recipient # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index # @option opts [Integer] :size Optional page size # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @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<(PageBouncedEmail, Integer, Hash)>] PageBouncedEmail data, response status code and response headers def get_bounced_emails_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.get_bounced_emails ...' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling BounceControllerApi.get_bounced_emails, must be smaller than or equal to 100.' 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 = '/bounce/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[:'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] || 'PageBouncedEmail' # 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: BounceControllerApi#get_bounced_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a bounced email. # Bounced emails are email you have sent that were rejected by a recipient # @param id [String] ID of the bounced recipient # @param [Hash] opts the optional parameters # @return [BouncedRecipientDto] def get_bounced_recipient(id, opts = {}) data, _status_code, _headers = get_bounced_recipient_with_http_info(id, opts) data end # Get a bounced email. # Bounced emails are email you have sent that were rejected by a recipient # @param id [String] ID of the bounced recipient # @param [Hash] opts the optional parameters # @return [Array<(BouncedRecipientDto, Integer, Hash)>] BouncedRecipientDto data, response status code and response headers def get_bounced_recipient_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.get_bounced_recipient ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling BounceControllerApi.get_bounced_recipient" end # resource path local_var_path = '/bounce/recipients/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'BouncedRecipientDto' # 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: BounceControllerApi#get_bounced_recipient\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get paginated list of bounced recipients. # Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index (default to 0) # @option opts [Integer] :size Optional page size (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @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 [PageBouncedRecipients] def get_bounced_recipients(opts = {}) data, _status_code, _headers = get_bounced_recipients_with_http_info(opts) data end # Get paginated list of bounced recipients. # Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index # @option opts [Integer] :size Optional page size # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @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<(PageBouncedRecipients, Integer, Hash)>] PageBouncedRecipients data, response status code and response headers def get_bounced_recipients_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.get_bounced_recipients ...' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling BounceControllerApi.get_bounced_recipients, must be smaller than or equal to 100.' 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 = '/bounce/recipients' # 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[:'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] || 'PageBouncedRecipients' # 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: BounceControllerApi#get_bounced_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get paginated list of complaints. # SMTP complaints made against your account # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index (default to 0) # @option opts [Integer] :size Optional page size (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @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 [PageComplaint] def get_complaints(opts = {}) data, _status_code, _headers = get_complaints_with_http_info(opts) data end # Get paginated list of complaints. # SMTP complaints made against your account # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index # @option opts [Integer] :size Optional page size # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @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<(PageComplaint, Integer, Hash)>] PageComplaint data, response status code and response headers def get_complaints_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BounceControllerApi.get_complaints ...' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling BounceControllerApi.get_complaints, must be smaller than or equal to 100.' 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 = '/bounce/complaints' # 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[:'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] || 'PageComplaint' # 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: BounceControllerApi#get_complaints\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end