=begin
#Audit Log API

#The Audit Logs API lets you read audit log entries and track API calls or activities in the Bare Metal Cloud Portal.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#audit-log-api' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/audit/v1/)</b> 

The version of the OpenAPI document: 1.0
Contact: support@phoenixnap.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.1.0

=end

require 'cgi'

module AuditApi
  class EventsApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # List event logs.
    # Retrieves the event logs for given time period. All date & times are in UTC.
    # @param [Hash] opts the optional parameters
    # @option opts [Time] :from From the date and time (inclusive) to filter event log records by.
    # @option opts [Time] :to To the date and time (inclusive) to filter event log records by.
    # @option opts [Integer] :limit Limit the number of records returned.
    # @option opts [String] :order Ordering of the event&#39;s time. SortBy can be introduced later on. (default to 'ASC')
    # @option opts [String] :username The username that did the actions.
    # @option opts [String] :verb The HTTP verb corresponding to the action.
    # @option opts [String] :uri The request uri.
    # @return [Array<Event>]
    def events_get(opts = {})
      data, _status_code, _headers = events_get_with_http_info(opts)
      data
    end

    # List event logs.
    # Retrieves the event logs for given time period. All date &amp; times are in UTC.
    # @param [Hash] opts the optional parameters
    # @option opts [Time] :from From the date and time (inclusive) to filter event log records by.
    # @option opts [Time] :to To the date and time (inclusive) to filter event log records by.
    # @option opts [Integer] :limit Limit the number of records returned.
    # @option opts [String] :order Ordering of the event&#39;s time. SortBy can be introduced later on. (default to 'ASC')
    # @option opts [String] :username The username that did the actions.
    # @option opts [String] :verb The HTTP verb corresponding to the action.
    # @option opts [String] :uri The request uri.
    # @return [Array<(Array<Event>, Integer, Hash)>] Array<Event> data, response status code and response headers
    def events_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventsApi.events_get ...'
      end
      allowable_values = ["ASC", "DESC"]
      if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
        fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
      end
      allowable_values = ["POST", "PUT", "PATCH", "DELETE"]
      if @api_client.config.client_side_validation && opts[:'verb'] && !allowable_values.include?(opts[:'verb'])
        fail ArgumentError, "invalid value for \"verb\", must be one of #{allowable_values}"
      end
      # resource path
      local_var_path = '/events'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
      query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
      query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
      query_params[:'verb'] = opts[:'verb'] if !opts[:'verb'].nil?
      query_params[:'uri'] = opts[:'uri'] if !opts[:'uri'].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[:debug_body]

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

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

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