=begin
#Easy!Appointments API

#These are the OpenAPI specs that describe the REST API of Easy!Appointments.

OpenAPI spec version: 1.0.0
Contact: info@easyappointments.org
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.30
=end

module SwaggerClient
  class SettingsApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Get all settings
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :page 
    # @option opts [Integer] :length 
    # @option opts [String] :sort 
    # @option opts [String] :q 
    # @option opts [String] :fields 
    # @option opts [String] :with 
    # @return [SettingCollection]
    def settings_get(opts = {})
      data, _status_code, _headers = settings_get_with_http_info(opts)
      data
    end

    # Get all settings
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :page 
    # @option opts [Integer] :length 
    # @option opts [String] :sort 
    # @option opts [String] :q 
    # @option opts [String] :fields 
    # @option opts [String] :with 
    # @return [Array<(SettingCollection, Integer, Hash)>] SettingCollection data, response status code and response headers
    def settings_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: SettingsApi.settings_get ...'
      end
      # resource path
      local_var_path = '/settings'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
      query_params[:'length'] = opts[:'length'] if !opts[:'length'].nil?
      query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
      query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
      query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
      query_params[:'with'] = opts[:'with'] if !opts[:'with'].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 = opts[:return_type] || 'SettingCollection' 

      auth_names = opts[:auth_names] || ['BasicAuth', 'BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SettingsApi#settings_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get a setting
    # @param setting_name 
    # @param [Hash] opts the optional parameters
    # @return [SettingRecord]
    def settings_setting_name_get(setting_name, opts = {})
      data, _status_code, _headers = settings_setting_name_get_with_http_info(setting_name, opts)
      data
    end

    # Get a setting
    # @param setting_name 
    # @param [Hash] opts the optional parameters
    # @return [Array<(SettingRecord, Integer, Hash)>] SettingRecord data, response status code and response headers
    def settings_setting_name_get_with_http_info(setting_name, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: SettingsApi.settings_setting_name_get ...'
      end
      # verify the required parameter 'setting_name' is set
      if @api_client.config.client_side_validation && setting_name.nil?
        fail ArgumentError, "Missing the required parameter 'setting_name' when calling SettingsApi.settings_setting_name_get"
      end
      # resource path
      local_var_path = '/settings/{settingName}'.sub('{' + 'settingName' + '}', setting_name.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 = opts[:return_type] || 'SettingRecord' 

      auth_names = opts[:auth_names] || ['BasicAuth', 'BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SettingsApi#settings_setting_name_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update a setting
    # @param body 
    # @param setting_name 
    # @param [Hash] opts the optional parameters
    # @return [SettingRecord]
    def settings_setting_name_put(body, setting_name, opts = {})
      data, _status_code, _headers = settings_setting_name_put_with_http_info(body, setting_name, opts)
      data
    end

    # Update a setting
    # @param body 
    # @param setting_name 
    # @param [Hash] opts the optional parameters
    # @return [Array<(SettingRecord, Integer, Hash)>] SettingRecord data, response status code and response headers
    def settings_setting_name_put_with_http_info(body, setting_name, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: SettingsApi.settings_setting_name_put ...'
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling SettingsApi.settings_setting_name_put"
      end
      # verify the required parameter 'setting_name' is set
      if @api_client.config.client_side_validation && setting_name.nil?
        fail ArgumentError, "Missing the required parameter 'setting_name' when calling SettingsApi.settings_setting_name_put"
      end
      # resource path
      local_var_path = '/settings/{settingName}'.sub('{' + 'settingName' + '}', setting_name.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(body) 

      return_type = opts[:return_type] || 'SettingRecord' 

      auth_names = opts[:auth_names] || ['BasicAuth', 'BearerToken']
      data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SettingsApi#settings_setting_name_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
