=begin
#UltraCart Rest API V2

#UltraCart REST API Version 2

OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.15-SNAPSHOT

=end

require 'uri'

module UltracartClient
  class CouponApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end

    def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
      api_config = Configuration.new
      api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
      api_config.api_version = '2017-03-01'
      api_config.verify_ssl = verify_ssl

      api_client = ApiClient.new(api_config)
      api_client.config.debugging = debugging

      UltracartClient::CouponApi.new(api_client)
    end

    # Delete a coupon
    # Delete a coupon on the UltraCart account. 
    # @param coupon_oid The coupon_oid to delete.
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def delete_coupon(coupon_oid, opts = {})
      delete_coupon_with_http_info(coupon_oid, opts)
      nil
    end

    # Delete a coupon
    # Delete a coupon on the UltraCart account. 
    # @param coupon_oid The coupon_oid to delete.
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_coupon_with_http_info(coupon_oid, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupon ...'
      end
      # verify the required parameter 'coupon_oid' is set
      if @api_client.config.client_side_validation && coupon_oid.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.delete_coupon"
      end
      # resource path
      local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#delete_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Deletes multiple coupons
    # Delete coupons on the UltraCart account. 
    # @param coupon_delete_request Coupon oids to delete
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def delete_coupons_by_code(coupon_delete_request, opts = {})
      delete_coupons_by_code_with_http_info(coupon_delete_request, opts)
      nil
    end

    # Deletes multiple coupons
    # Delete coupons on the UltraCart account. 
    # @param coupon_delete_request Coupon oids to delete
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_coupons_by_code_with_http_info(coupon_delete_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupons_by_code ...'
      end
      # verify the required parameter 'coupon_delete_request' is set
      if @api_client.config.client_side_validation && coupon_delete_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_delete_request' when calling CouponApi.delete_coupons_by_code"
      end
      # resource path
      local_var_path = '/coupon/coupons/by_code'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon_delete_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#delete_coupons_by_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Deletes multiple coupons
    # Delete coupons on the UltraCart account. 
    # @param coupon_delete_request Coupon oids to delete
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def delete_coupons_by_oid(coupon_delete_request, opts = {})
      delete_coupons_by_oid_with_http_info(coupon_delete_request, opts)
      nil
    end

    # Deletes multiple coupons
    # Delete coupons on the UltraCart account. 
    # @param coupon_delete_request Coupon oids to delete
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_coupons_by_oid_with_http_info(coupon_delete_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupons_by_oid ...'
      end
      # verify the required parameter 'coupon_delete_request' is set
      if @api_client.config.client_side_validation && coupon_delete_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_delete_request' when calling CouponApi.delete_coupons_by_oid"
      end
      # resource path
      local_var_path = '/coupon/coupons/by_oid'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon_delete_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#delete_coupons_by_oid\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Determines if a coupon merchant code already exists
    # Determines if a coupon merchant code already exists. 
    # @param merchant_code The coupon merchant code to examine.
    # @param [Hash] opts the optional parameters
    # @return [CouponExistsResponse]
    def does_coupon_code_exist(merchant_code, opts = {})
      data, _status_code, _headers = does_coupon_code_exist_with_http_info(merchant_code, opts)
      data
    end

    # Determines if a coupon merchant code already exists
    # Determines if a coupon merchant code already exists. 
    # @param merchant_code The coupon merchant code to examine.
    # @param [Hash] opts the optional parameters
    # @return [Array<(CouponExistsResponse, Fixnum, Hash)>] CouponExistsResponse data, response status code and response headers
    def does_coupon_code_exist_with_http_info(merchant_code, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.does_coupon_code_exist ...'
      end
      # verify the required parameter 'merchant_code' is set
      if @api_client.config.client_side_validation && merchant_code.nil?
        fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.does_coupon_code_exist"
      end
      # resource path
      local_var_path = '/coupon/coupons/merchant_code/{merchant_code}/exists'.sub('{' + 'merchant_code' + '}', merchant_code.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponExistsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#does_coupon_code_exist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Generates one time codes for a coupon
    # Generate one time codes for a coupon 
    # @param coupon_oid The coupon oid to generate codes.
    # @param coupon_codes_request Coupon code generation parameters
    # @param [Hash] opts the optional parameters
    # @return [CouponCodesResponse]
    def generate_coupon_codes(coupon_oid, coupon_codes_request, opts = {})
      data, _status_code, _headers = generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request, opts)
      data
    end

    # Generates one time codes for a coupon
    # Generate one time codes for a coupon 
    # @param coupon_oid The coupon oid to generate codes.
    # @param coupon_codes_request Coupon code generation parameters
    # @param [Hash] opts the optional parameters
    # @return [Array<(CouponCodesResponse, Fixnum, Hash)>] CouponCodesResponse data, response status code and response headers
    def generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.generate_coupon_codes ...'
      end
      # verify the required parameter 'coupon_oid' is set
      if @api_client.config.client_side_validation && coupon_oid.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.generate_coupon_codes"
      end
      # verify the required parameter 'coupon_codes_request' is set
      if @api_client.config.client_side_validation && coupon_codes_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_codes_request' when calling CouponApi.generate_coupon_codes"
      end
      # resource path
      local_var_path = '/coupon/coupons/{coupon_oid}/generate_codes'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon_codes_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'CouponCodesResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#generate_coupon_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Generates one time codes by merchant code
    # Generate one time codes by merchant code 
    # @param merchant_code The merchant code to generate one time codes.
    # @param coupon_codes_request Coupon code generation parameters
    # @param [Hash] opts the optional parameters
    # @return [CouponCodesResponse]
    def generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request, opts = {})
      data, _status_code, _headers = generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request, opts)
      data
    end

    # Generates one time codes by merchant code
    # Generate one time codes by merchant code 
    # @param merchant_code The merchant code to generate one time codes.
    # @param coupon_codes_request Coupon code generation parameters
    # @param [Hash] opts the optional parameters
    # @return [Array<(CouponCodesResponse, Fixnum, Hash)>] CouponCodesResponse data, response status code and response headers
    def generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.generate_one_time_codes_by_merchant_code ...'
      end
      # verify the required parameter 'merchant_code' is set
      if @api_client.config.client_side_validation && merchant_code.nil?
        fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.generate_one_time_codes_by_merchant_code"
      end
      # verify the required parameter 'coupon_codes_request' is set
      if @api_client.config.client_side_validation && coupon_codes_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_codes_request' when calling CouponApi.generate_one_time_codes_by_merchant_code"
      end
      # resource path
      local_var_path = '/coupon/coupons/merchant_code/{merchant_code}/generate_codes'.sub('{' + 'merchant_code' + '}', merchant_code.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon_codes_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'CouponCodesResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#generate_one_time_codes_by_merchant_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve auto apply rules and conditions
    # Retrieve auto apply rules and conditions 
    # @param [Hash] opts the optional parameters
    # @return [CouponAutoApplyConditions]
    def get_auto_apply(opts = {})
      data, _status_code, _headers = get_auto_apply_with_http_info(opts)
      data
    end

    # Retrieve auto apply rules and conditions
    # Retrieve auto apply rules and conditions 
    # @param [Hash] opts the optional parameters
    # @return [Array<(CouponAutoApplyConditions, Fixnum, Hash)>] CouponAutoApplyConditions data, response status code and response headers
    def get_auto_apply_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_auto_apply ...'
      end
      # resource path
      local_var_path = '/coupon/auto_apply'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponAutoApplyConditions')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_auto_apply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve a coupon
    # Retrieves a single coupon using the specified coupon profile oid. 
    # @param coupon_oid The coupon oid to retrieve.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponResponse]
    def get_coupon(coupon_oid, opts = {})
      data, _status_code, _headers = get_coupon_with_http_info(coupon_oid, opts)
      data
    end

    # Retrieve a coupon
    # Retrieves a single coupon using the specified coupon profile oid. 
    # @param coupon_oid The coupon oid to retrieve.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponResponse, Fixnum, Hash)>] CouponResponse data, response status code and response headers
    def get_coupon_with_http_info(coupon_oid, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_coupon ...'
      end
      # verify the required parameter 'coupon_oid' is set
      if @api_client.config.client_side_validation && coupon_oid.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.get_coupon"
      end
      # resource path
      local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve a coupon by merchant code
    # Retrieves a single coupon using the specified merchant code. 
    # @param merchant_code The coupon merchant code to retrieve.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponResponse]
    def get_coupon_by_merchant_code(merchant_code, opts = {})
      data, _status_code, _headers = get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
      data
    end

    # Retrieve a coupon by merchant code
    # Retrieves a single coupon using the specified merchant code. 
    # @param merchant_code The coupon merchant code to retrieve.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponResponse, Fixnum, Hash)>] CouponResponse data, response status code and response headers
    def get_coupon_by_merchant_code_with_http_info(merchant_code, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_coupon_by_merchant_code ...'
      end
      # verify the required parameter 'merchant_code' is set
      if @api_client.config.client_side_validation && merchant_code.nil?
        fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.get_coupon_by_merchant_code"
      end
      # resource path
      local_var_path = '/coupon/coupons/merchant_code/{merchant_code}'.sub('{' + 'merchant_code' + '}', merchant_code.to_s)

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_coupon_by_merchant_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve coupons
    # Retrieves coupons for this account.  If no parameters are specified, all coupons will be returned.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :merchant_code Merchant code
    # @option opts [String] :description Description
    # @option opts [String] :coupon_type Coupon type
    # @option opts [String] :start_date_begin Start date begin
    # @option opts [String] :start_date_end Start date end
    # @option opts [String] :expiration_date_begin Expiration date begin
    # @option opts [String] :expiration_date_end Expiration date end
    # @option opts [Integer] :affiliate_oid Affiliate oid
    # @option opts [BOOLEAN] :exclude_expired Exclude expired
    # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100)
    # @option opts [Integer] :_offset Pagination of the record set.  Offset is a zero based index. (default to 0)
    # @option opts [String] :_sort The sort order of the coupons.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponsResponse]
    def get_coupons(opts = {})
      data, _status_code, _headers = get_coupons_with_http_info(opts)
      data
    end

    # Retrieve coupons
    # Retrieves coupons for this account.  If no parameters are specified, all coupons will be returned.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :merchant_code Merchant code
    # @option opts [String] :description Description
    # @option opts [String] :coupon_type Coupon type
    # @option opts [String] :start_date_begin Start date begin
    # @option opts [String] :start_date_end Start date end
    # @option opts [String] :expiration_date_begin Expiration date begin
    # @option opts [String] :expiration_date_end Expiration date end
    # @option opts [Integer] :affiliate_oid Affiliate oid
    # @option opts [BOOLEAN] :exclude_expired Exclude expired
    # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200)
    # @option opts [Integer] :_offset Pagination of the record set.  Offset is a zero based index.
    # @option opts [String] :_sort The sort order of the coupons.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponsResponse, Fixnum, Hash)>] CouponsResponse data, response status code and response headers
    def get_coupons_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_coupons ...'
      end
      # resource path
      local_var_path = '/coupon/coupons'

      # query parameters
      query_params = {}
      query_params[:'merchant_code'] = opts[:'merchant_code'] if !opts[:'merchant_code'].nil?
      query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
      query_params[:'coupon_type'] = opts[:'coupon_type'] if !opts[:'coupon_type'].nil?
      query_params[:'start_date_begin'] = opts[:'start_date_begin'] if !opts[:'start_date_begin'].nil?
      query_params[:'start_date_end'] = opts[:'start_date_end'] if !opts[:'start_date_end'].nil?
      query_params[:'expiration_date_begin'] = opts[:'expiration_date_begin'] if !opts[:'expiration_date_begin'].nil?
      query_params[:'expiration_date_end'] = opts[:'expiration_date_end'] if !opts[:'expiration_date_end'].nil?
      query_params[:'affiliate_oid'] = opts[:'affiliate_oid'] if !opts[:'affiliate_oid'].nil?
      query_params[:'exclude_expired'] = opts[:'exclude_expired'] if !opts[:'exclude_expired'].nil?
      query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
      query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
      query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve coupons by query
    # Retrieves coupons from the account.  If no parameters are specified, all coupons will be returned.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. 
    # @param coupon_query Coupon query
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100)
    # @option opts [Integer] :_offset Pagination of the record set.  Offset is a zero based index. (default to 0)
    # @option opts [String] :_sort The sort order of the coupons.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponsResponse]
    def get_coupons_by_query(coupon_query, opts = {})
      data, _status_code, _headers = get_coupons_by_query_with_http_info(coupon_query, opts)
      data
    end

    # Retrieve coupons by query
    # Retrieves coupons from the account.  If no parameters are specified, all coupons will be returned.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. 
    # @param coupon_query Coupon query
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200)
    # @option opts [Integer] :_offset Pagination of the record set.  Offset is a zero based index.
    # @option opts [String] :_sort The sort order of the coupons.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponsResponse, Fixnum, Hash)>] CouponsResponse data, response status code and response headers
    def get_coupons_by_query_with_http_info(coupon_query, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_coupons_by_query ...'
      end
      # verify the required parameter 'coupon_query' is set
      if @api_client.config.client_side_validation && coupon_query.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_query' when calling CouponApi.get_coupons_by_query"
      end
      # resource path
      local_var_path = '/coupon/coupons/query'

      # query parameters
      query_params = {}
      query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
      query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
      query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon_query)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_coupons_by_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Retrieve values needed for a coupon editor
    # Retrieve values needed for a coupon editor 
    # @param [Hash] opts the optional parameters
    # @return [CouponEditorValues]
    def get_editor_values(opts = {})
      data, _status_code, _headers = get_editor_values_with_http_info(opts)
      data
    end

    # Retrieve values needed for a coupon editor
    # Retrieve values needed for a coupon editor 
    # @param [Hash] opts the optional parameters
    # @return [Array<(CouponEditorValues, Fixnum, Hash)>] CouponEditorValues data, response status code and response headers
    def get_editor_values_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.get_editor_values ...'
      end
      # resource path
      local_var_path = '/coupon/editor_values'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponEditorValues')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#get_editor_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Insert a coupon
    # Insert a coupon on the UltraCart account. 
    # @param coupon Coupon to insert
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponResponse]
    def insert_coupon(coupon, opts = {})
      data, _status_code, _headers = insert_coupon_with_http_info(coupon, opts)
      data
    end

    # Insert a coupon
    # Insert a coupon on the UltraCart account. 
    # @param coupon Coupon to insert
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponResponse, Fixnum, Hash)>] CouponResponse data, response status code and response headers
    def insert_coupon_with_http_info(coupon, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupon ...'
      end
      # verify the required parameter 'coupon' is set
      if @api_client.config.client_side_validation && coupon.nil?
        fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponApi.insert_coupon"
      end
      # resource path
      local_var_path = '/coupon/coupons'

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'CouponResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#insert_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Insert multiple coupons
    # Insert multiple coupon on the UltraCart account. 
    # @param coupons_request Coupons to insert (maximum 50)
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
    # @return [CouponsResponse]
    def insert_coupons(coupons_request, opts = {})
      data, _status_code, _headers = insert_coupons_with_http_info(coupons_request, opts)
      data
    end

    # Insert multiple coupons
    # Insert multiple coupon on the UltraCart account. 
    # @param coupons_request Coupons to insert (maximum 50)
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
    # @return [Array<(CouponsResponse, Fixnum, Hash)>] CouponsResponse data, response status code and response headers
    def insert_coupons_with_http_info(coupons_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupons ...'
      end
      # verify the required parameter 'coupons_request' is set
      if @api_client.config.client_side_validation && coupons_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupons_request' when calling CouponApi.insert_coupons"
      end
      # resource path
      local_var_path = '/coupon/coupons/batch'

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
      query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupons_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'CouponsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#insert_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Searches for items to display within a coupon editor and assign to coupons
    # Searches for items to display within a coupon editor and assign to coupons 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :s 
    # @option opts [Integer] :m 
    # @return [CouponItemSearchResultsResponse]
    def search_items(opts = {})
      data, _status_code, _headers = search_items_with_http_info(opts)
      data
    end

    # Searches for items to display within a coupon editor and assign to coupons
    # Searches for items to display within a coupon editor and assign to coupons 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :s 
    # @option opts [Integer] :m 
    # @return [Array<(CouponItemSearchResultsResponse, Fixnum, Hash)>] CouponItemSearchResultsResponse data, response status code and response headers
    def search_items_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.search_items ...'
      end
      # resource path
      local_var_path = '/coupon/searchItems'

      # query parameters
      query_params = {}
      query_params[:'s'] = opts[:'s'] if !opts[:'s'].nil?
      query_params[:'m'] = opts[:'m'] if !opts[:'m'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = nil
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponItemSearchResultsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#search_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update auto apply rules and conditions
    # Update auto apply rules and conditions 
    # @param conditions Conditions
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def update_auto_apply(conditions, opts = {})
      update_auto_apply_with_http_info(conditions, opts)
      nil
    end

    # Update auto apply rules and conditions
    # Update auto apply rules and conditions 
    # @param conditions Conditions
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def update_auto_apply_with_http_info(conditions, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.update_auto_apply ...'
      end
      # verify the required parameter 'conditions' is set
      if @api_client.config.client_side_validation && conditions.nil?
        fail ArgumentError, "Missing the required parameter 'conditions' when calling CouponApi.update_auto_apply"
      end
      # resource path
      local_var_path = '/coupon/auto_apply'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(conditions)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#update_auto_apply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update a coupon
    # Update a coupon on the UltraCart account. 
    # @param coupon Coupon to update
    # @param coupon_oid The coupon_oid to update.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [CouponResponse]
    def update_coupon(coupon, coupon_oid, opts = {})
      data, _status_code, _headers = update_coupon_with_http_info(coupon, coupon_oid, opts)
      data
    end

    # Update a coupon
    # Update a coupon on the UltraCart account. 
    # @param coupon Coupon to update
    # @param coupon_oid The coupon_oid to update.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @return [Array<(CouponResponse, Fixnum, Hash)>] CouponResponse data, response status code and response headers
    def update_coupon_with_http_info(coupon, coupon_oid, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.update_coupon ...'
      end
      # verify the required parameter 'coupon' is set
      if @api_client.config.client_side_validation && coupon.nil?
        fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponApi.update_coupon"
      end
      # verify the required parameter 'coupon_oid' is set
      if @api_client.config.client_side_validation && coupon_oid.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.update_coupon"
      end
      # resource path
      local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupon)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#update_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update multiple coupons
    # Update multiple coupon on the UltraCart account. 
    # @param coupons_request Coupons to update (synchronous maximum 50 / asynchronous maximum 100)
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
    # @option opts [BOOLEAN] :_async True if the operation should be run async.  No result returned
    # @return [CouponsResponse]
    def update_coupons(coupons_request, opts = {})
      data, _status_code, _headers = update_coupons_with_http_info(coupons_request, opts)
      data
    end

    # Update multiple coupons
    # Update multiple coupon on the UltraCart account. 
    # @param coupons_request Coupons to update (synchronous maximum 50 / asynchronous maximum 100)
    # @param [Hash] opts the optional parameters
    # @option opts [String] :_expand The object expansion to perform on the result.  See documentation for examples
    # @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
    # @option opts [BOOLEAN] :_async True if the operation should be run async.  No result returned
    # @return [Array<(CouponsResponse, Fixnum, Hash)>] CouponsResponse data, response status code and response headers
    def update_coupons_with_http_info(coupons_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.update_coupons ...'
      end
      # verify the required parameter 'coupons_request' is set
      if @api_client.config.client_side_validation && coupons_request.nil?
        fail ArgumentError, "Missing the required parameter 'coupons_request' when calling CouponApi.update_coupons"
      end
      # resource path
      local_var_path = '/coupon/coupons/batch'

      # query parameters
      query_params = {}
      query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
      query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?
      query_params[:'_async'] = opts[:'_async'] if !opts[:'_async'].nil?

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(coupons_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      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 => 'CouponsResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#update_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Upload one-time codes for a coupon
    # Upload one-time codes for a coupon 
    # @param coupon_oid The coupon oid to associate with the provided one-time codes.
    # @param upload_coupon_codes_request One-time coupon codes
    # @param [Hash] opts the optional parameters
    # @return [UploadCouponCodesResponse]
    def upload_coupon_codes(coupon_oid, upload_coupon_codes_request, opts = {})
      data, _status_code, _headers = upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request, opts)
      data
    end

    # Upload one-time codes for a coupon
    # Upload one-time codes for a coupon 
    # @param coupon_oid The coupon oid to associate with the provided one-time codes.
    # @param upload_coupon_codes_request One-time coupon codes
    # @param [Hash] opts the optional parameters
    # @return [Array<(UploadCouponCodesResponse, Fixnum, Hash)>] UploadCouponCodesResponse data, response status code and response headers
    def upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: CouponApi.upload_coupon_codes ...'
      end
      # verify the required parameter 'coupon_oid' is set
      if @api_client.config.client_side_validation && coupon_oid.nil?
        fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.upload_coupon_codes"
      end
      # verify the required parameter 'upload_coupon_codes_request' is set
      if @api_client.config.client_side_validation && upload_coupon_codes_request.nil?
        fail ArgumentError, "Missing the required parameter 'upload_coupon_codes_request' when calling CouponApi.upload_coupon_codes"
      end
      # resource path
      local_var_path = '/coupon/coupons/{coupon_oid}/upload_codes'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
      # 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; charset=UTF-8'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(upload_coupon_codes_request)
      auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'UploadCouponCodesResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CouponApi#upload_coupon_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end