=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 AstronomyApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # The Astronomy API provides the location-based rise and set times for the Sun and Moon along with the current position, distance from earth, and azimuth of the Sun and the Moon for a specific date at the queried time. 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :ip query paramter &#39;ip&#39;. If not provided, will be your network IP
    # @option opts [String] :location query paramter &#39;location&#39;. If not provided, will be your ip location
    # @option opts [String] :lat query paramter &#39;lat&#39;.
    # @option opts [String] :long query paramter &#39;long&#39;.
    # @option opts [String] :time_zone 
    # @option opts [String] :date The date (YYYY-MM-DD) to lookup for. default will be the current date
    # @option opts [Float] :elevation query parameter &#39;elevation&#39;
    # @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 [AstronomyResponse]
    def get_astronomy_details(opts = {})
      data, _status_code, _headers = get_astronomy_details_with_http_info(opts)
      data
    end

    # The Astronomy API provides the location-based rise and set times for the Sun and Moon along with the current position, distance from earth, and azimuth of the Sun and the Moon for a specific date at the queried time. 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :ip query paramter &#39;ip&#39;. If not provided, will be your network IP
    # @option opts [String] :location query paramter &#39;location&#39;. If not provided, will be your ip location
    # @option opts [String] :lat query paramter &#39;lat&#39;.
    # @option opts [String] :long query paramter &#39;long&#39;.
    # @option opts [String] :time_zone 
    # @option opts [String] :date The date (YYYY-MM-DD) to lookup for. default will be the current date
    # @option opts [Float] :elevation query parameter &#39;elevation&#39;
    # @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<(AstronomyResponse, Integer, Hash)>] AstronomyResponse data, response status code and response headers
    def get_astronomy_details_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AstronomyApi.get_astronomy_details ...'
      end
      if @api_client.config.client_side_validation && !opts[:'elevation'].nil? && opts[:'elevation'] > 10000
        fail ArgumentError, 'invalid value for "opts[:"elevation"]" when calling AstronomyApi.get_astronomy_details, must be smaller than or equal to 10000.'
      end

      if @api_client.config.client_side_validation && !opts[:'elevation'].nil? && opts[:'elevation'] < 0
        fail ArgumentError, 'invalid value for "opts[:"elevation"]" when calling AstronomyApi.get_astronomy_details, must be greater than or equal to 0.'
      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 = '/astronomy'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
      query_params[:'location'] = opts[:'location'] if !opts[:'location'].nil?
      query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
      query_params[:'long'] = opts[:'long'] if !opts[:'long'].nil?
      query_params[:'time_zone'] = opts[:'time_zone'] if !opts[:'time_zone'].nil?
      query_params[:'date'] = opts[:'date'] if !opts[:'date'].nil?
      query_params[:'elevation'] = opts[:'elevation'] if !opts[:'elevation'].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] || 'AstronomyResponse'

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

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