=begin
#IPGeolocation.io - IP intelligence products

#Ipgeolocation provides a set of APIs to make ip based decisions.

The version of the OpenAPI document: 2.0

Generated by: https://openapi-generator.tech
Generator version: 7.13.0

=end

require 'cgi'

module IpgeolocationSdk
  class IPSecurityApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # The Bulk IP Security Lookup API can provide security details for up to `50,000` bulk IPs. This API also has parameters to customize the response, just like the single IP Security Lookup API.
    # @param get_bulk_ip_geolocation_request [GetBulkIpGeolocationRequest] 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :include Include optional objects like &#x60;location&#x60;, &#x60;network&#x60;.  Use comma-separated values. Example: include&#x3D;location,network 
    # @option opts [String] :fields Get specific fields, objects from the response.
    # @option opts [String] :excludes Exclude specific fields, objects from the response.
    # @option opts [String] :output Desired output format.
    # @option opts [String] :lang By default, the API responds in English. You can change the response language by passing the language code as a query parameter &#x60;lang&#x60;. Multi language feature is available only for &#x60;paid users&#x60;.
    # @return [Array<GetBulkIpSecurityInfo200ResponseInner>]
    def get_bulk_ip_security_info(opts = {})
      data, _status_code, _headers = get_bulk_ip_security_info_with_http_info(opts)
      data
    end

    # The Bulk IP Security Lookup API can provide security details for up to &#x60;50,000&#x60; bulk IPs. This API also has parameters to customize the response, just like the single IP Security Lookup API.
    # @param get_bulk_ip_geolocation_request [GetBulkIpGeolocationRequest] 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :include Include optional objects like &#x60;location&#x60;, &#x60;network&#x60;.  Use comma-separated values. Example: include&#x3D;location,network 
    # @option opts [String] :fields Get specific fields, objects from the response.
    # @option opts [String] :excludes Exclude specific fields, objects from the response.
    # @option opts [String] :output Desired output format.
    # @option opts [String] :lang By default, the API responds in English. You can change the response language by passing the language code as a query parameter &#x60;lang&#x60;. Multi language feature is available only for &#x60;paid users&#x60;.
    # @return [Array<(Array<GetBulkIpSecurityInfo200ResponseInner>, Integer, Hash)>] Array<GetBulkIpSecurityInfo200ResponseInner> data, response status code and response headers
    def get_bulk_ip_security_info_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: SecurityApi.get_bulk_ip_security_info ...'
      end
      # verify the required parameter 'get_bulk_ip_geolocation_request' is set
      if @api_client.config.client_side_validation && (!opts[:ips].is_a?(Array) || opts[:ips].empty?)
        fail ArgumentError, "Missing the required parameter 'ips' (non-empty Array) when calling IPSecurityApi.get_bulk_ip_security_info"
      end
      allowable_values = ["en", "de", "ru", "ja", "fr", "cn", "es", "cs", "it", "ko", "fa", "pt"]
      if @api_client.config.client_side_validation && opts[:'lang'] && !allowable_values.include?(opts[:'lang'])
        fail ArgumentError, "invalid value for \"lang\", must be one of #{allowable_values}"
      end
      # resource path
      local_var_path = '/security-bulk'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
      query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
      query_params[:'excludes'] = opts[:'excludes'] if !opts[:'excludes'].nil?
      query_params[:'output'] = opts[:'output'] if !opts[:'output'].nil?
      query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml']) unless header_params['Accept']
      # 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({ ips: opts[:ips] })

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

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

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

    # IP Security API provides security details of a given IP. It detects whether the IP is proxy, tor or bot. It also shows the proxy types of the IP (like VPN, PROXY, RELAY etc.) with it's VPN/proxy service provider making our API powerful VPN checker. It finds the IPs that are involved in spam activities. It also checks whether the IP links to a cloud provider and includes the provider's name.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :ip query parameter &#39;ip&#39;. If not provided, will be your network IP
    # @option opts [String] :include Include optional details like location and/or network.
    # @option opts [String] :fields Get specific fields, objects from the response.
    # @option opts [String] :excludes Exclude specific fields, objects from the response.
    # @option opts [String] :output Desired output format (json or xml).
    # @option opts [String] :lang By default, the API responds in English. You can change the response language by passing the language code as a query parameter &#x60;lang&#x60;. Multi language feature is available only for &#x60;paid users&#x60;.
    # @return [SecurityAPIResponse]
    def get_ip_security_info(opts = {})
      data, _status_code, _headers = get_ip_security_info_with_http_info(opts)
      data
    end

    # IP Security API provides security details of a given IP. It detects whether the IP is proxy, tor or bot. It also shows the proxy types of the IP (like VPN, PROXY, RELAY etc.) with it&#39;s VPN/proxy service provider making our API powerful VPN checker. It finds the IPs that are involved in spam activities. It also checks whether the IP links to a cloud provider and includes the provider&#39;s name.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :ip query parameter &#39;ip&#39;. If not provided, will be your network IP
    # @option opts [String] :include Include optional details like location and/or network.
    # @option opts [String] :fields Get specific fields, objects from the response.
    # @option opts [String] :excludes Exclude specific fields, objects from the response.
    # @option opts [String] :output Desired output format (json or xml).
    # @option opts [String] :lang By default, the API responds in English. You can change the response language by passing the language code as a query parameter &#x60;lang&#x60;. Multi language feature is available only for &#x60;paid users&#x60;.
    # @return [Array<(SecurityAPIResponse, Integer, Hash)>] SecurityAPIResponse data, response status code and response headers
    def get_ip_security_info_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: IPSecurityApi.get_ip_security_info ...'
      end
      allowable_values = ["en", "de", "ru", "ja", "fr", "cn", "es", "cs", "it", "ko", "fa", "pt"]
      if @api_client.config.client_side_validation && opts[:'lang'] && !allowable_values.include?(opts[:'lang'])
        fail ArgumentError, "invalid value for \"lang\", must be one of #{allowable_values}"
      end
      # resource path
      local_var_path = '/security'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
      query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
      query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
      query_params[:'excludes'] = opts[:'excludes'] if !opts[:'excludes'].nil?
      query_params[:'output'] = opts[:'output'] if !opts[:'output'].nil?
      query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml']) unless header_params['Accept']

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

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

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

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

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