=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://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository The version of the OpenAPI document: 6.5.2 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module MailSlurpClient class EmailControllerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete all emails # Deletes all emails in your account. Be careful as emails cannot be recovered # @param [Hash] opts the optional parameters # @return [nil] def delete_all_emails(opts = {}) delete_all_emails_with_http_info(opts) nil end # Delete all emails # Deletes all emails in your account. Be careful as emails cannot be recovered # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_all_emails_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_all_emails ...' end # resource path local_var_path = '/emails' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # 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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#delete_all_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an email # Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. # @param email_id [String] ID of email to delete # @param [Hash] opts the optional parameters # @return [nil] def delete_email(email_id, opts = {}) delete_email_with_http_info(email_id, opts) nil end # Delete an email # Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. # @param email_id [String] ID of email to delete # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.delete_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # 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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#delete_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. # Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. # @return [String] def download_attachment(attachment_id, email_id, opts = {}) data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts) data end # Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. # Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers def download_attachment_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'apiKey'] = opts[:'api_key'] if !opts[:'api_key'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: EmailControllerApi#download_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email attachment as base64 encoded string (alternative to binary responses) # Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [DownloadAttachmentDto] def download_attachment_base64(attachment_id, email_id, opts = {}) data, _status_code, _headers = download_attachment_base64_with_http_info(attachment_id, email_id, opts) data end # Get email attachment as base64 encoded string (alternative to binary responses) # Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(DownloadAttachmentDto, Integer, Hash)>] DownloadAttachmentDto data, response status code and response headers def download_attachment_base64_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment_base64 ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment_base64" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment_base64" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'DownloadAttachmentDto' # 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: EmailControllerApi#download_attachment_base64\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Forward email # Forward an existing email to new recipients. # @param email_id [String] ID of email # @param forward_email_options [ForwardEmailOptions] forwardEmailOptions # @param [Hash] opts the optional parameters # @return [nil] def forward_email(email_id, forward_email_options, opts = {}) forward_email_with_http_info(email_id, forward_email_options, opts) nil end # Forward email # Forward an existing email to new recipients. # @param email_id [String] ID of email # @param forward_email_options [ForwardEmailOptions] forwardEmailOptions # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def forward_email_with_http_info(email_id, forward_email_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.forward_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.forward_email" end # verify the required parameter 'forward_email_options' is set if @api_client.config.client_side_validation && forward_email_options.nil? fail ArgumentError, "Missing the required parameter 'forward_email_options' when calling EmailControllerApi.forward_email" end # resource path local_var_path = '/emails/{emailId}/forward'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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(forward_email_options) # return_type return_type = opts[:return_type] # 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: EmailControllerApi#forward_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email attachment metadata # Returns the metadata such as name and content-type for a given attachment and email. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [AttachmentMetaData] def get_attachment_meta_data(attachment_id, email_id, opts = {}) data, _status_code, _headers = get_attachment_meta_data_with_http_info(attachment_id, email_id, opts) data end # Get email attachment metadata # Returns the metadata such as name and content-type for a given attachment and email. # @param attachment_id [String] ID of attachment # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(AttachmentMetaData, Integer, Hash)>] AttachmentMetaData data, response status code and response headers def get_attachment_meta_data_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachment_meta_data ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.get_attachment_meta_data" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachment_meta_data" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'AttachmentMetaData' # 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: EmailControllerApi#get_attachment_meta_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all email attachment metadata # Returns an array of attachment metadata such as name and content-type for a given email if present. # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array] def get_attachments(email_id, opts = {}) data, _status_code, _headers = get_attachments_with_http_info(email_id, opts) data end # Get all email attachment metadata # Returns an array of attachment metadata such as name and content-type for a given email if present. # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_attachments_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachments ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachments" end # resource path local_var_path = '/emails/{emailId}/attachments'.sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array' # 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: EmailControllerApi#get_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email content # Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints # @param email_id [String] emailId # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (default to false) # @return [Email] def get_email(email_id, opts = {}) data, _status_code, _headers = get_email_with_http_info(email_id, opts) data end # Get email content # Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints # @param email_id [String] emailId # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers def get_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # 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: EmailControllerApi#get_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email content regex pattern match results. Runs regex against email body and returns match groups. # Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. # @param email_id [String] ID of email to match against # @param content_match_options [ContentMatchOptions] contentMatchOptions # @param [Hash] opts the optional parameters # @return [EmailContentMatchResult] def get_email_content_match(email_id, content_match_options, opts = {}) data, _status_code, _headers = get_email_content_match_with_http_info(email_id, content_match_options, opts) data end # Get email content regex pattern match results. Runs regex against email body and returns match groups. # Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. # @param email_id [String] ID of email to match against # @param content_match_options [ContentMatchOptions] contentMatchOptions # @param [Hash] opts the optional parameters # @return [Array<(EmailContentMatchResult, Integer, Hash)>] EmailContentMatchResult data, response status code and response headers def get_email_content_match_with_http_info(email_id, content_match_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_content_match ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_content_match" end # verify the required parameter 'content_match_options' is set if @api_client.config.client_side_validation && content_match_options.nil? fail ArgumentError, "Missing the required parameter 'content_match_options' when calling EmailControllerApi.get_email_content_match" end # resource path local_var_path = '/emails/{emailId}/contentMatch'.sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # 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(content_match_options) # return_type return_type = opts[:return_type] || 'EmailContentMatchResult' # 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: EmailControllerApi#get_email_content_match\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email content as HTML # Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` # @param email_id [String] emailId # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode decode (default to false) # @return [String] def get_email_html(email_id, opts = {}) data, _status_code, _headers = get_email_html_with_http_info(email_id, opts) data end # Get email content as HTML # Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` # @param email_id [String] emailId # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode decode # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers def get_email_html_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html" end # resource path local_var_path = '/emails/{emailId}/html'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/html']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: EmailControllerApi#get_email_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Parse and return text from an email, stripping HTML and decoding encoded characters # Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors # @param email_id [String] ID of email to perform HTML query on # @param [Hash] opts the optional parameters # @option opts [String] :html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. # @return [EmailTextLinesResult] def get_email_html_query(email_id, opts = {}) data, _status_code, _headers = get_email_html_query_with_http_info(email_id, opts) data end # Parse and return text from an email, stripping HTML and decoding encoded characters # Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors # @param email_id [String] ID of email to perform HTML query on # @param [Hash] opts the optional parameters # @option opts [String] :html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. # @return [Array<(EmailTextLinesResult, Integer, Hash)>] EmailTextLinesResult data, response status code and response headers def get_email_html_query_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html_query ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html_query" end # resource path local_var_path = '/emails/{emailId}/htmlQuery'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'htmlSelector'] = opts[:'html_selector'] if !opts[:'html_selector'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailTextLinesResult' # 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: EmailControllerApi#get_email_html_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Parse and return text from an email, stripping HTML and decoding encoded characters # Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. # @param email_id [String] ID of email to fetch text for # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode_html_entities Decode HTML entities # @option opts [String] :line_separator Line separator character # @return [EmailTextLinesResult] def get_email_text_lines(email_id, opts = {}) data, _status_code, _headers = get_email_text_lines_with_http_info(email_id, opts) data end # Parse and return text from an email, stripping HTML and decoding encoded characters # Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. # @param email_id [String] ID of email to fetch text for # @param [Hash] opts the optional parameters # @option opts [Boolean] :decode_html_entities Decode HTML entities # @option opts [String] :line_separator Line separator character # @return [Array<(EmailTextLinesResult, Integer, Hash)>] EmailTextLinesResult data, response status code and response headers def get_email_text_lines_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_text_lines ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_text_lines" end # resource path local_var_path = '/emails/{emailId}/textLines'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decodeHtmlEntities'] = opts[:'decode_html_entities'] if !opts[:'decode_html_entities'].nil? query_params[:'lineSeparator'] = opts[:'line_separator'] if !opts[:'line_separator'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailTextLinesResult' # 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: EmailControllerApi#get_email_text_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all emails in all inboxes. Email API list all. # By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. # @option opts [Integer] :page Optional page index in email list pagination (default to 0) # @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false) # @return [PageEmailProjection] def get_emails_paginated(opts = {}) data, _status_code, _headers = get_emails_paginated_with_http_info(opts) data end # Get all emails in all inboxes. Email API list all. # By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. # @option opts [Integer] :page Optional page index in email list pagination # @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly # @return [Array<(PageEmailProjection, Integer, Hash)>] PageEmailProjection data, response status code and response headers def get_emails_paginated_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_emails_paginated ...' 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 = '/emails' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil? 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[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageEmailProjection' # 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: EmailControllerApi#get_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get latest email # Get the newest email in all inboxes or in a passed set of inbox IDs # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs # @return [Email] def get_latest_email(opts = {}) data, _status_code, _headers = get_latest_email_with_http_info(opts) data end # Get latest email # Get the newest email in all inboxes or in a passed set of inbox IDs # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers def get_latest_email_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email ...' end # resource path local_var_path = '/emails/latest' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxIds'] = @api_client.build_collection_param(opts[:'inbox_ids'], :multi) if !opts[:'inbox_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # 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: EmailControllerApi#get_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get latest email # Get the newest email in all inboxes or in a passed set of inbox IDs # @param [Hash] opts the optional parameters # @option opts [String] :inbox_id ID of the inbox you want to get the latest email from # @return [Email] def get_latest_email_in_inbox(opts = {}) data, _status_code, _headers = get_latest_email_in_inbox_with_http_info(opts) data end # Get latest email # Get the newest email in all inboxes or in a passed set of inbox IDs # @param [Hash] opts the optional parameters # @option opts [String] :inbox_id ID of the inbox you want to get the latest email from # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers def get_latest_email_in_inbox_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email_in_inbox ...' end # resource path local_var_path = '/emails/latestIn' # query parameters query_params = opts[:query_params] || {} 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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # 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: EmailControllerApi#get_latest_email_in_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all organization emails. List team or shared test email accounts # By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. # @option opts [Integer] :page Optional page index in email list pagination (default to 0) # @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false) # @return [PageEmailProjection] def get_organization_emails_paginated(opts = {}) data, _status_code, _headers = get_organization_emails_paginated_with_http_info(opts) data end # Get all organization emails. List team or shared test email accounts # By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [Array] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. # @option opts [Integer] :page Optional page index in email list pagination # @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly # @return [Array<(PageEmailProjection, Integer, Hash)>] PageEmailProjection data, response status code and response headers def get_organization_emails_paginated_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_organization_emails_paginated ...' 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 = '/emails/organization' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil? 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[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageEmailProjection' # 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: EmailControllerApi#get_organization_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get raw email string # Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [String] def get_raw_email_contents(email_id, opts = {}) data, _status_code, _headers = get_raw_email_contents_with_http_info(email_id, opts) data end # Get raw email string # Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers def get_raw_email_contents_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_contents ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_contents" end # resource path local_var_path = '/emails/{emailId}/raw'.sub('{' + 'emailId' + '}', CGI.escape(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(['text/plain']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: EmailControllerApi#get_raw_email_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get raw email in JSON # Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [RawEmailJson] def get_raw_email_json(email_id, opts = {}) data, _status_code, _headers = get_raw_email_json_with_http_info(email_id, opts) data end # Get raw email in JSON # Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(RawEmailJson, Integer, Hash)>] RawEmailJson data, response status code and response headers def get_raw_email_json_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_json ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_json" end # resource path local_var_path = '/emails/{emailId}/raw/json'.sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'RawEmailJson' # 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: EmailControllerApi#get_raw_email_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get unread email count # Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response # @param [Hash] opts the optional parameters # @return [UnreadCount] def get_unread_email_count(opts = {}) data, _status_code, _headers = get_unread_email_count_with_http_info(opts) data end # Get unread email count # Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response # @param [Hash] opts the optional parameters # @return [Array<(UnreadCount, Integer, Hash)>] UnreadCount data, response status code and response headers def get_unread_email_count_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_unread_email_count ...' end # resource path local_var_path = '/emails/unreadCount' # 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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'UnreadCount' # 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: EmailControllerApi#get_unread_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reply to an email # Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. # @param email_id [String] ID of the email that should be replied to # @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions # @param [Hash] opts the optional parameters # @return [SentEmailDto] def reply_to_email(email_id, reply_to_email_options, opts = {}) data, _status_code, _headers = reply_to_email_with_http_info(email_id, reply_to_email_options, opts) data end # Reply to an email # Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. # @param email_id [String] ID of the email that should be replied to # @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions # @param [Hash] opts the optional parameters # @return [Array<(SentEmailDto, Integer, Hash)>] SentEmailDto data, response status code and response headers def reply_to_email_with_http_info(email_id, reply_to_email_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.reply_to_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.reply_to_email" end # verify the required parameter 'reply_to_email_options' is set if @api_client.config.client_side_validation && reply_to_email_options.nil? fail ArgumentError, "Missing the required parameter 'reply_to_email_options' when calling EmailControllerApi.reply_to_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # 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(reply_to_email_options) # return_type return_type = opts[:return_type] || 'SentEmailDto' # 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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#reply_to_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate email # Validate the HTML content of email if HTML is found. Considered valid if no HTML. # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [ValidationDto] def validate_email(email_id, opts = {}) data, _status_code, _headers = validate_email_with_http_info(email_id, opts) data end # Validate email # Validate the HTML content of email if HTML is found. Considered valid if no HTML. # @param email_id [String] ID of email # @param [Hash] opts the optional parameters # @return [Array<(ValidationDto, Integer, Hash)>] ValidationDto data, response status code and response headers def validate_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.validate_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.validate_email" end # resource path local_var_path = '/emails/{emailId}/validate'.sub('{' + 'emailId' + '}', CGI.escape(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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ValidationDto' # 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: EmailControllerApi#validate_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end