=begin
#Subskribe API

#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: 1.0.0

Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.41

=end

require 'uri'

module SubskribeDevClient
  class AccountsApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Add a new account
    # Create an account with the specified parameters. On success, the id of the newly created account is returned
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [AccountJson]
    def add_account(opts = {})
      data, _status_code, _headers = add_account_with_http_info(opts)
      data
    end

    # Add a new account
    # Create an account with the specified parameters. On success, the id of the newly created account is returned
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [Array<(AccountJson, Fixnum, Hash)>] AccountJson data, response status code and response headers
    def add_account_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.add_account ...'
      end
      # resource path
      local_var_path = '/accounts'

      # query parameters
      query_params = {}

      # header parameters
      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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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 => 'AccountJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#add_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Add a contact for an account
    # Creates and adds a new contact for the specified account and returns the new contact ID
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountContactJson] :body 
    # @option opts [BOOLEAN] :skip_address_validation value &#x3D; perform basic address validation
    # @option opts [BOOLEAN] :strict_validation value &#x3D; require the address to match a canonical address, if it exists
    # @return [AccountContactJson]
    def add_account_contact(account_id, opts = {})
      data, _status_code, _headers = add_account_contact_with_http_info(account_id, opts)
      data
    end

    # Add a contact for an account
    # Creates and adds a new contact for the specified account and returns the new contact ID
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountContactJson] :body 
    # @option opts [BOOLEAN] :skip_address_validation value &#x3D; perform basic address validation
    # @option opts [BOOLEAN] :strict_validation value &#x3D; require the address to match a canonical address, if it exists
    # @return [Array<(AccountContactJson, Fixnum, Hash)>] AccountContactJson data, response status code and response headers
    def add_account_contact_with_http_info(account_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.add_account_contact ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.add_account_contact"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/contacts'.sub('{' + 'accountId' + '}', account_id.to_s)

      # query parameters
      query_params = {}
      query_params[:'skipAddressValidation'] = opts[:'skip_address_validation'] if !opts[:'skip_address_validation'].nil?
      query_params[:'strictValidation'] = opts[:'strict_validation'] if !opts[:'strict_validation'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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 => 'AccountContactJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#add_account_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Add a payment method to an account
    # Add a payment method to the specified account and return its ID
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountPaymentMethodJson] :body 
    # @return [AccountPaymentMethodJson]
    def add_account_payment_method(account_id, opts = {})
      data, _status_code, _headers = add_account_payment_method_with_http_info(account_id, opts)
      data
    end

    # Add a payment method to an account
    # Add a payment method to the specified account and return its ID
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountPaymentMethodJson] :body 
    # @return [Array<(AccountPaymentMethodJson, Fixnum, Hash)>] AccountPaymentMethodJson data, response status code and response headers
    def add_account_payment_method_with_http_info(account_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.add_account_payment_method ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.add_account_payment_method"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/paymentMethods'.sub('{' + 'accountId' + '}', account_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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 => 'AccountPaymentMethodJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#add_account_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Delete an account
    # Deletes the account associated with the passed ID
    # @param id 
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def delete_account(id, opts = {})
      delete_account_with_http_info(id, opts)
      nil
    end

    # Delete an account
    # Deletes the account associated with the passed ID
    # @param id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_account_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.delete_account ...'
      end
      # verify the required parameter 'id' is set
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.delete_account"
      end
      # resource path
      local_var_path = '/accounts/{id}'.sub('{' + 'id' + '}', id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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: AccountsApi#delete_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Delete a contact
    # Deletes the contact specified by the account id and contact id
    # @param contact_id 
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def delete_account_contact(contact_id, account_id, opts = {})
      delete_account_contact_with_http_info(contact_id, account_id, opts)
      nil
    end

    # Delete a contact
    # Deletes the contact specified by the account id and contact id
    # @param contact_id 
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_account_contact_with_http_info(contact_id, account_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.delete_account_contact ...'
      end
      # verify the required parameter 'contact_id' is set
      if @api_client.config.client_side_validation && contact_id.nil?
        fail ArgumentError, "Missing the required parameter 'contact_id' when calling AccountsApi.delete_account_contact"
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.delete_account_contact"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/contacts/{contactId}'.sub('{' + 'contactId' + '}', contact_id.to_s).sub('{' + 'accountId' + '}', account_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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: AccountsApi#delete_account_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get an account by id
    # Returns the details of the account specified by the passed id
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :id_type 
    # @return [AccountJson]
    def get_account(id, opts = {})
      data, _status_code, _headers = get_account_with_http_info(id, opts)
      data
    end

    # Get an account by id
    # Returns the details of the account specified by the passed id
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :id_type 
    # @return [Array<(AccountJson, Fixnum, Hash)>] AccountJson data, response status code and response headers
    def get_account_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_account ...'
      end
      # verify the required parameter 'id' is set
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.get_account"
      end
      if @api_client.config.client_side_validation && opts[:'id_type'] && !['ACCOUNT_ID', 'CRM_ID', 'EXTERNAL_ID'].include?(opts[:'id_type'])
        fail ArgumentError, 'invalid value for "id_type", must be one of ACCOUNT_ID, CRM_ID, EXTERNAL_ID'
      end
      # resource path
      local_var_path = '/accounts/{id}'.sub('{' + 'id' + '}', id.to_s)

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

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'AccountJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Gets contact details
    # Returns the details of the specified contact
    # @param account_id 
    # @param contact_id 
    # @param [Hash] opts the optional parameters
    # @return [AccountContactJson]
    def get_account_contact(account_id, contact_id, opts = {})
      data, _status_code, _headers = get_account_contact_with_http_info(account_id, contact_id, opts)
      data
    end

    # Gets contact details
    # Returns the details of the specified contact
    # @param account_id 
    # @param contact_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(AccountContactJson, Fixnum, Hash)>] AccountContactJson data, response status code and response headers
    def get_account_contact_with_http_info(account_id, contact_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_contact ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_contact"
      end
      # verify the required parameter 'contact_id' is set
      if @api_client.config.client_side_validation && contact_id.nil?
        fail ArgumentError, "Missing the required parameter 'contact_id' when calling AccountsApi.get_account_contact"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/contacts/{contactId}'.sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'AccountContactJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_account_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get contacts for an account
    # Returns a list of contacts associated with the specified account id
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :expand 
    # @return [Array<AccountContactJson>]
    def get_account_contacts(account_id, opts = {})
      data, _status_code, _headers = get_account_contacts_with_http_info(account_id, opts)
      data
    end

    # Get contacts for an account
    # Returns a list of contacts associated with the specified account id
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :expand 
    # @return [Array<(Array<AccountContactJson>, Fixnum, Hash)>] Array<AccountContactJson> data, response status code and response headers
    def get_account_contacts_with_http_info(account_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_contacts ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_contacts"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/contacts'.sub('{' + 'accountId' + '}', account_id.to_s)

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

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'Array<AccountContactJson>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_account_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Returns metrics for the specified account
    # Fetches metrics such as ARR, TCV, etc for the specified account as of the specified target date
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :target_date 
    # @return [MetricsJson]
    def get_account_metrics(id, opts = {})
      data, _status_code, _headers = get_account_metrics_with_http_info(id, opts)
      data
    end

    # Returns metrics for the specified account
    # Fetches metrics such as ARR, TCV, etc for the specified account as of the specified target date
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :target_date 
    # @return [Array<(MetricsJson, Fixnum, Hash)>] MetricsJson data, response status code and response headers
    def get_account_metrics_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_metrics ...'
      end
      # verify the required parameter 'id' is set
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.get_account_metrics"
      end
      # resource path
      local_var_path = '/accounts/{id}/metrics'.sub('{' + 'id' + '}', id.to_s)

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

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'MetricsJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_account_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get the payment methods for an account
    # Returns a list of payment methods for the specified account id
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<AccountPaymentMethodJson>]
    def get_account_payment_methods(account_id, opts = {})
      data, _status_code, _headers = get_account_payment_methods_with_http_info(account_id, opts)
      data
    end

    # Get the payment methods for an account
    # Returns a list of payment methods for the specified account id
    # @param account_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<AccountPaymentMethodJson>, Fixnum, Hash)>] Array<AccountPaymentMethodJson> data, response status code and response headers
    def get_account_payment_methods_with_http_info(account_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_payment_methods ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_payment_methods"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/paymentMethods'.sub('{' + 'accountId' + '}', account_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'Array<AccountPaymentMethodJson>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_account_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get all accounts
    # Returns a paginated list of accounts
    # @param [Hash] opts the optional parameters
    # @option opts [String] :cursor 
    # @option opts [Integer] :limit 
    # @option opts [String] :type 
    # @return [Array<AccountJson>]
    def get_accounts(opts = {})
      data, _status_code, _headers = get_accounts_with_http_info(opts)
      data
    end

    # Get all accounts
    # Returns a paginated list of accounts
    # @param [Hash] opts the optional parameters
    # @option opts [String] :cursor 
    # @option opts [Integer] :limit 
    # @option opts [String] :type 
    # @return [Array<(Array<AccountJson>, Fixnum, Hash)>] Array<AccountJson> data, response status code and response headers
    def get_accounts_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'
      end
      # resource path
      local_var_path = '/accounts'

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

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'Array<AccountJson>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get the details of a payment method
    # Returns the details of the payment method for the specified account id and payment method id
    # @param account_id 
    # @param id 
    # @param [Hash] opts the optional parameters
    # @return [AccountPaymentMethodJson]
    def get_payment_method(account_id, id, opts = {})
      data, _status_code, _headers = get_payment_method_with_http_info(account_id, id, opts)
      data
    end

    # Get the details of a payment method
    # Returns the details of the payment method for the specified account id and payment method id
    # @param account_id 
    # @param id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(AccountPaymentMethodJson, Fixnum, Hash)>] AccountPaymentMethodJson data, response status code and response headers
    def get_payment_method_with_http_info(account_id, id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.get_payment_method ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_payment_method"
      end
      # verify the required parameter 'id' is set
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.get_payment_method"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/paymentMethods/{id}'.sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'id' + '}', id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['ApiKeyAuth']
      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 => 'AccountPaymentMethodJson')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#get_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Import an account from a CRM
    # Ensures an account exists which matches the passed details.If an account exists that has a matching CRM Id, it will be updated, if not, it will be created
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [CrmAccountImportResponse]
    def import_crm_account(opts = {})
      data, _status_code, _headers = import_crm_account_with_http_info(opts)
      data
    end

    # Import an account from a CRM
    # Ensures an account exists which matches the passed details.If an account exists that has a matching CRM Id, it will be updated, if not, it will be created
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [Array<(CrmAccountImportResponse, Fixnum, Hash)>] CrmAccountImportResponse data, response status code and response headers
    def import_crm_account_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.import_crm_account ...'
      end
      # resource path
      local_var_path = '/accounts/crm/import'

      # query parameters
      query_params = {}

      # header parameters
      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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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 => 'CrmAccountImportResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#import_crm_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update an account
    # Updates an existing account with the specified parameters
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [nil]
    def update_account(id, opts = {})
      update_account_with_http_info(id, opts)
      nil
    end

    # Update an account
    # Updates an existing account with the specified parameters
    # @param id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountJson] :body 
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def update_account_with_http_info(id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.update_account ...'
      end
      # verify the required parameter 'id' is set
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.update_account"
      end
      # resource path
      local_var_path = '/accounts/{id}'.sub('{' + 'id' + '}', id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      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 = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#update_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update a contact
    # Updates the contact specified by the account id and contact id with the passed information
    # @param account_id 
    # @param contact_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountContactJson] :body 
    # @option opts [BOOLEAN] :skip_address_validation 
    # @option opts [BOOLEAN] :strict_validation 
    # @return [nil]
    def update_account_contact(account_id, contact_id, opts = {})
      update_account_contact_with_http_info(account_id, contact_id, opts)
      nil
    end

    # Update a contact
    # Updates the contact specified by the account id and contact id with the passed information
    # @param account_id 
    # @param contact_id 
    # @param [Hash] opts the optional parameters
    # @option opts [AccountContactJson] :body 
    # @option opts [BOOLEAN] :skip_address_validation 
    # @option opts [BOOLEAN] :strict_validation 
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def update_account_contact_with_http_info(account_id, contact_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: AccountsApi.update_account_contact ...'
      end
      # verify the required parameter 'account_id' is set
      if @api_client.config.client_side_validation && account_id.nil?
        fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.update_account_contact"
      end
      # verify the required parameter 'contact_id' is set
      if @api_client.config.client_side_validation && contact_id.nil?
        fail ArgumentError, "Missing the required parameter 'contact_id' when calling AccountsApi.update_account_contact"
      end
      # resource path
      local_var_path = '/accounts/{accountId}/contacts/{contactId}'.sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

      # query parameters
      query_params = {}
      query_params[:'skipAddressValidation'] = opts[:'skip_address_validation'] if !opts[:'skip_address_validation'].nil?
      query_params[:'strictValidation'] = opts[:'strict_validation'] if !opts[:'strict_validation'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['ApiKeyAuth']
      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)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: AccountsApi#update_account_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end