=begin
#Elastic Email REST API

#This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.    Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.    The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request.    To start using this API, you will need your Access Token (available <a target=\"_blank\" href=\"https://elasticemail.com/account#/settings/new/manage-api\">here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description.    This is the documentation for REST API. If you’d like to read our legacy documentation regarding Web API v2 click <a target=\"_blank\" href=\"https://api.elasticemail.com/public/help\">here</a>.    Downloadable library clients can be found in our Github repository <a target=\"_blank\" href=\"https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme\">here</a>

The version of the OpenAPI document: 4.0.0
Contact: support@elasticemail.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.3.0

=end

require 'cgi'

module ElasticEmail
  class InboundRouteApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Delete Route
    # Deletes the Inbound Route. Required Access Level: ModifySettings
    # @param id [String] 
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def inboundroute_by_id_delete(id, opts = {})
      inboundroute_by_id_delete_with_http_info(id, opts)
      nil
    end

    # Delete Route
    # Deletes the Inbound Route. Required Access Level: ModifySettings
    # @param id [String] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def inboundroute_by_id_delete_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_by_id_delete ...'
      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 InboundRouteApi.inboundroute_by_id_delete"
      end
      # resource path
      local_var_path = '/inboundroute/{id}'.sub('{' + 'id' + '}', CGI.escape(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[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_by_id_delete",
        :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: InboundRouteApi#inboundroute_by_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Get Route
    # Load an Inbound Route. Required Access Level: ViewSettings
    # @param id [String] ID number of your attachment
    # @param [Hash] opts the optional parameters
    # @return [InboundRoute]
    def inboundroute_by_id_get(id, opts = {})
      data, _status_code, _headers = inboundroute_by_id_get_with_http_info(id, opts)
      data
    end

    # Get Route
    # Load an Inbound Route. Required Access Level: ViewSettings
    # @param id [String] ID number of your attachment
    # @param [Hash] opts the optional parameters
    # @return [Array<(InboundRoute, Integer, Hash)>] InboundRoute data, response status code and response headers
    def inboundroute_by_id_get_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_by_id_get ...'
      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 InboundRouteApi.inboundroute_by_id_get"
      end
      # resource path
      local_var_path = '/inboundroute/{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(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'InboundRoute'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_by_id_get",
        :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: InboundRouteApi#inboundroute_by_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Update Route
    # Update the Inbound Route. Required Access Level: ModifySettings
    # @param id [String] 
    # @param inbound_payload [InboundPayload] 
    # @param [Hash] opts the optional parameters
    # @return [InboundRoute]
    def inboundroute_by_id_put(id, inbound_payload, opts = {})
      data, _status_code, _headers = inboundroute_by_id_put_with_http_info(id, inbound_payload, opts)
      data
    end

    # Update Route
    # Update the Inbound Route. Required Access Level: ModifySettings
    # @param id [String] 
    # @param inbound_payload [InboundPayload] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(InboundRoute, Integer, Hash)>] InboundRoute data, response status code and response headers
    def inboundroute_by_id_put_with_http_info(id, inbound_payload, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_by_id_put ...'
      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 InboundRouteApi.inboundroute_by_id_put"
      end
      # verify the required parameter 'inbound_payload' is set
      if @api_client.config.client_side_validation && inbound_payload.nil?
        fail ArgumentError, "Missing the required parameter 'inbound_payload' when calling InboundRouteApi.inboundroute_by_id_put"
      end
      # resource path
      local_var_path = '/inboundroute/{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(['application/json'])
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(inbound_payload)

      # return_type
      return_type = opts[:debug_return_type] || 'InboundRoute'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_by_id_put",
        :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: InboundRouteApi#inboundroute_by_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Get Routes
    # Get all your Inbound Routes. Required Access Level: ViewSettings
    # @param [Hash] opts the optional parameters
    # @return [Array<InboundRoute>]
    def inboundroute_get(opts = {})
      data, _status_code, _headers = inboundroute_get_with_http_info(opts)
      data
    end

    # Get Routes
    # Get all your Inbound Routes. Required Access Level: ViewSettings
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<InboundRoute>, Integer, Hash)>] Array<InboundRoute> data, response status code and response headers
    def inboundroute_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_get ...'
      end
      # resource path
      local_var_path = '/inboundroute'

      # 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[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Array<InboundRoute>'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_get",
        :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: InboundRouteApi#inboundroute_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Update Sorting
    # Required Access Level: ViewSettings
    # @param sort_order_item [Array<SortOrderItem>] Change the ordering of inbound routes for when matching the inbound
    # @param [Hash] opts the optional parameters
    # @return [Array<InboundRoute>]
    def inboundroute_order_put(sort_order_item, opts = {})
      data, _status_code, _headers = inboundroute_order_put_with_http_info(sort_order_item, opts)
      data
    end

    # Update Sorting
    # Required Access Level: ViewSettings
    # @param sort_order_item [Array<SortOrderItem>] Change the ordering of inbound routes for when matching the inbound
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<InboundRoute>, Integer, Hash)>] Array<InboundRoute> data, response status code and response headers
    def inboundroute_order_put_with_http_info(sort_order_item, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_order_put ...'
      end
      # verify the required parameter 'sort_order_item' is set
      if @api_client.config.client_side_validation && sort_order_item.nil?
        fail ArgumentError, "Missing the required parameter 'sort_order_item' when calling InboundRouteApi.inboundroute_order_put"
      end
      # resource path
      local_var_path = '/inboundroute/order'

      # 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'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(sort_order_item)

      # return_type
      return_type = opts[:debug_return_type] || 'Array<InboundRoute>'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_order_put",
        :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: InboundRouteApi#inboundroute_order_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Create Route
    # Create new Inbound Route. Required Access Level: ModifySettings
    # @param inbound_payload [InboundPayload] 
    # @param [Hash] opts the optional parameters
    # @return [InboundRoute]
    def inboundroute_post(inbound_payload, opts = {})
      data, _status_code, _headers = inboundroute_post_with_http_info(inbound_payload, opts)
      data
    end

    # Create Route
    # Create new Inbound Route. Required Access Level: ModifySettings
    # @param inbound_payload [InboundPayload] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(InboundRoute, Integer, Hash)>] InboundRoute data, response status code and response headers
    def inboundroute_post_with_http_info(inbound_payload, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: InboundRouteApi.inboundroute_post ...'
      end
      # verify the required parameter 'inbound_payload' is set
      if @api_client.config.client_side_validation && inbound_payload.nil?
        fail ArgumentError, "Missing the required parameter 'inbound_payload' when calling InboundRouteApi.inboundroute_post"
      end
      # resource path
      local_var_path = '/inboundroute'

      # 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'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(inbound_payload)

      # return_type
      return_type = opts[:debug_return_type] || 'InboundRoute'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['apikey']

      new_options = opts.merge(
        :operation => :"InboundRouteApi.inboundroute_post",
        :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: InboundRouteApi#inboundroute_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end