text: # coding: utf-8
  
  """
      BillForward REST API
  
  
      OpenAPI spec version: 1.0.0
      
      Generated by: https://github.com/swagger-api/swagger-codegen.git
  
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
  """
  
  from __future__ import absolute_import
  
  import sys
  import os
  import re
  
  # python 2 and python 3 compatibility library
  from six import iteritems
  
  from ..configuration import Configuration
  from ..api_client import ApiClient
  
  
  class InvoicesApi(object):
      """
      NOTE: This class is auto generated by the swagger code generator program.
      Do not edit the class manually.
      Ref: https://github.com/swagger-api/swagger-codegen
      """
  
      def __init__(self, api_client=None):
          config = Configuration()
          if api_client:
              self.api_client = api_client
          else:
              if not config.api_client:
                  config.api_client = ApiClient()
              self.api_client = config.api_client
  
      def add_charge_to_invoice(self, invoice_id, charge, **kwargs):
          """
          Creates a charge on the specified invoice.
          {\"nickname\":\"Add to invoice\",\"response\":\"addChargeToInvoice.html\",\"request\":\"addChargeToInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.add_charge_to_invoice(invoice_id, charge, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: ID of the invoice. (required)
          :param AddChargeRequest charge: The charge request (required)
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.add_charge_to_invoice_with_http_info(invoice_id, charge, **kwargs)
          else:
              (data) = self.add_charge_to_invoice_with_http_info(invoice_id, charge, **kwargs)
              return data
  
      def add_charge_to_invoice_with_http_info(self, invoice_id, charge, **kwargs):
          """
          Creates a charge on the specified invoice.
          {\"nickname\":\"Add to invoice\",\"response\":\"addChargeToInvoice.html\",\"request\":\"addChargeToInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.add_charge_to_invoice_with_http_info(invoice_id, charge, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: ID of the invoice. (required)
          :param AddChargeRequest charge: The charge request (required)
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'charge']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method add_charge_to_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `add_charge_to_invoice`")
          # verify the required parameter 'charge' is set
          if ('charge' not in params) or (params['charge'] is None):
              raise ValueError("Missing the required parameter `charge` when calling `add_charge_to_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/charges'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'charge' in params:
              body_params = params['charge']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='SubscriptionChargePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def aggregate_invoices(self, request, **kwargs):
          """
          Aggregate Invoices into to one parent Invoice
          {\"nickname\":\"Aggregate invoices\",\"response\":\"AggregateResponse.html\",\"request\":\"AggregateRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.aggregate_invoices(request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.aggregate_invoices_with_http_info(request, **kwargs)
          else:
              (data) = self.aggregate_invoices_with_http_info(request, **kwargs)
              return data
  
      def aggregate_invoices_with_http_info(self, request, **kwargs):
          """
          Aggregate Invoices into to one parent Invoice
          {\"nickname\":\"Aggregate invoices\",\"response\":\"AggregateResponse.html\",\"request\":\"AggregateRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.aggregate_invoices_with_http_info(request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['request']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method aggregate_invoices" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'request' is set
          if ('request' not in params) or (params['request'] is None):
              raise ValueError("Missing the required parameter `request` when calling `aggregate_invoices`")
  
          resource_path = '/invoices/aggregate'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'request' in params:
              body_params = params['request']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def execute_invoice(self, invoice_id, request, **kwargs):
          """
          Attempt payment for the outstanding value of an invoice
          {\"nickname\":\"Execute invoice\",\"response\":\"executeInvoiceResponse.html\",\"request\":\"ExecuteInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.execute_invoice(invoice_id, request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.execute_invoice_with_http_info(invoice_id, request, **kwargs)
          else:
              (data) = self.execute_invoice_with_http_info(invoice_id, request, **kwargs)
              return data
  
      def execute_invoice_with_http_info(self, invoice_id, request, **kwargs):
          """
          Attempt payment for the outstanding value of an invoice
          {\"nickname\":\"Execute invoice\",\"response\":\"executeInvoiceResponse.html\",\"request\":\"ExecuteInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.execute_invoice_with_http_info(invoice_id, request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'request']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method execute_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `execute_invoice`")
          # verify the required parameter 'request' is set
          if ('request' not in params) or (params['request'] is None):
              raise ValueError("Missing the required parameter `request` when calling `execute_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/execute'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'request' in params:
              body_params = params['request']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def generate_line_payments_for_all_invoices(self, **kwargs):
          """
          Generates InvoiceLinePayments for all existing InvoicePayments.
          { \"nickname\" : \"Generate InvoiceLinePayments\",\"response\" : \"Generate InvoiceLinePayments.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.generate_line_payments_for_all_invoices(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.generate_line_payments_for_all_invoices_with_http_info(**kwargs)
          else:
              (data) = self.generate_line_payments_for_all_invoices_with_http_info(**kwargs)
              return data
  
      def generate_line_payments_for_all_invoices_with_http_info(self, **kwargs):
          """
          Generates InvoiceLinePayments for all existing InvoicePayments.
          { \"nickname\" : \"Generate InvoiceLinePayments\",\"response\" : \"Generate InvoiceLinePayments.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.generate_line_payments_for_all_invoices_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method generate_line_payments_for_all_invoices" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/generate-line-payments'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_all_invoices(self, **kwargs):
          """
          Retrieves a collection of all invoices. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve all invoices\",\"response\" : \"getInvoiceAll.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_all_invoices(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :param str metadata: 
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_all_invoices_with_http_info(**kwargs)
          else:
              (data) = self.get_all_invoices_with_http_info(**kwargs)
              return data
  
      def get_all_invoices_with_http_info(self, **kwargs):
          """
          Retrieves a collection of all invoices. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve all invoices\",\"response\" : \"getInvoiceAll.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_all_invoices_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :param str metadata: 
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'exclude_children', 'metadata']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_all_invoices" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'exclude_children' in params:
              query_params['exclude_children'] = params['exclude_children']
          if 'metadata' in params:
              query_params['metadata'] = params['metadata']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_all_invoices_as_csv(self, **kwargs):
          """
          Retrieves a collection of all invoices. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve all invoices\",\"response\" : \"getInvoiceAll.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_all_invoices_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_all_invoices_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_all_invoices_as_csv_with_http_info(**kwargs)
              return data
  
      def get_all_invoices_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves a collection of all invoices. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve all invoices\",\"response\" : \"getInvoiceAll.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_all_invoices_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_all_invoices_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/all.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_bucketed_revenue_attributions_as_csv(self, **kwargs):
          """
          Retrieves (as CSV) all attributions of Invoice costs to Invoice lines, bucketed.
          { \"nickname\" : \"(CSV) Retrieve bucketed revenue attributions\",\"response\" : \"getBucketedRevenueAttributions.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_bucketed_revenue_attributions_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_bucketed_revenue_attributions_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_bucketed_revenue_attributions_as_csv_with_http_info(**kwargs)
              return data
  
      def get_bucketed_revenue_attributions_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves (as CSV) all attributions of Invoice costs to Invoice lines, bucketed.
          { \"nickname\" : \"(CSV) Retrieve bucketed revenue attributions\",\"response\" : \"getBucketedRevenueAttributions.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_bucketed_revenue_attributions_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_bucketed_revenue_attributions_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/bucketed-revenue-attributions.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept([])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type([])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='str',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_charges_on_invoice(self, invoice_id, **kwargs):
          """
          Returns all charges for the specified invoice. By default 10 values are returned. Records are returned in natural order.
          {\"nickname\":\"List on invoice\",\"response\":\"getChargesInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_charges_on_invoice(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param str state: Ihe direction of any ordering, either ASC or DESC.
          :param str type: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired subscriptions should be returned.
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_charges_on_invoice_with_http_info(invoice_id, **kwargs)
          else:
              (data) = self.get_charges_on_invoice_with_http_info(invoice_id, **kwargs)
              return data
  
      def get_charges_on_invoice_with_http_info(self, invoice_id, **kwargs):
          """
          Returns all charges for the specified invoice. By default 10 values are returned. Records are returned in natural order.
          {\"nickname\":\"List on invoice\",\"response\":\"getChargesInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_charges_on_invoice_with_http_info(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param str state: Ihe direction of any ordering, either ASC or DESC.
          :param str type: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired subscriptions should be returned.
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'state', 'type', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_charges_on_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `get_charges_on_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/charges'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'state' in params:
              query_params['state'] = params['state']
          if 'type' in params:
              query_params['type'] = params['type']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='SubscriptionChargePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_credit_invoice_line_payments_from_invoices_as_csv(self, **kwargs):
          """
          Retrieves credit note-paid from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Credit InvoiceLinePayments CSV\",\"response\" : \"Credit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_credit_invoice_line_payments_from_invoices_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which credit payments will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which credit payments will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_credit_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_credit_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
              return data
  
      def get_credit_invoice_line_payments_from_invoices_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves credit note-paid from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Credit InvoiceLinePayments CSV\",\"response\" : \"Credit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_credit_invoice_line_payments_from_invoices_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which credit payments will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which credit payments will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_credit_invoice_line_payments_from_invoices_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/credit.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received(self, **kwargs):
          """
          Retrieves credit note-paid from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Credit InvoiceLinePayments CSV\",\"response\" : \"Credit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which credit payments will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which credit payments will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(**kwargs)
          else:
              (data) = self.get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(**kwargs)
              return data
  
      def get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(self, **kwargs):
          """
          Retrieves credit note-paid from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Credit InvoiceLinePayments CSV\",\"response\" : \"Credit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which credit payments will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which credit payments will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_credit_invoice_line_payments_from_invoices_as_csv_by_payment_received" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/payment-received/credit.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_debit_invoice_line_payments_from_invoices_as_csv(self, **kwargs):
          """
          Retrieves received revenue from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Debit InvoiceLinePayments CSV\",\"response\" : \"Debit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_debit_invoice_line_payments_from_invoices_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_debit_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_debit_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
              return data
  
      def get_debit_invoice_line_payments_from_invoices_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves received revenue from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Debit InvoiceLinePayments CSV\",\"response\" : \"Debit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_debit_invoice_line_payments_from_invoices_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_debit_invoice_line_payments_from_invoices_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/revenue.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received(self, **kwargs):
          """
          Retrieves received revenue from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Debit InvoiceLinePayments CSV\",\"response\" : \"Debit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(**kwargs)
          else:
              (data) = self.get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(**kwargs)
              return data
  
      def get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(self, **kwargs):
          """
          Retrieves received revenue from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Debit InvoiceLinePayments CSV\",\"response\" : \"Debit InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_debit_invoice_line_payments_from_invoices_as_csv_by_payment_received" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/payment-received/revenue.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_as_html(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"HTML invoice\",\"response\" : \"getInvoiceByID.HTML.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_as_html(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool tier_breakdown: Whether to provide a breakdown of charge tiering.
          :param bool inclusive_end: Whether to present in the Invoice date range only those dates whose entirety are involved in the billing period. In other words: when true, this subtracts 1 from the \"period end\" date shown to the customer.
          :param bool show_zero_cost: Whether to show zero-cost lines.
          :param bool show_plan_only_when_ambiguous: Whether to state which plan the Invoice lines came from, regardless of whether there's only one plan involved in this Invoice.
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_as_html_with_http_info(id, **kwargs)
          else:
              (data) = self.get_invoice_as_html_with_http_info(id, **kwargs)
              return data
  
      def get_invoice_as_html_with_http_info(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"HTML invoice\",\"response\" : \"getInvoiceByID.HTML.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_as_html_with_http_info(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool tier_breakdown: Whether to provide a breakdown of charge tiering.
          :param bool inclusive_end: Whether to present in the Invoice date range only those dates whose entirety are involved in the billing period. In other words: when true, this subtracts 1 from the \"period end\" date shown to the customer.
          :param bool show_zero_cost: Whether to show zero-cost lines.
          :param bool show_plan_only_when_ambiguous: Whether to state which plan the Invoice lines came from, regardless of whether there's only one plan involved in this Invoice.
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'tier_breakdown', 'inclusive_end', 'show_zero_cost', 'show_plan_only_when_ambiguous']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_as_html" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'id' is set
          if ('id' not in params) or (params['id'] is None):
              raise ValueError("Missing the required parameter `id` when calling `get_invoice_as_html`")
  
          resource_path = '/invoices/{ID}.html'.replace('{format}', 'json')
          path_params = {}
          if 'id' in params:
              path_params['ID'] = params['id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'tier_breakdown' in params:
              query_params['tier_breakdown'] = params['tier_breakdown']
          if 'inclusive_end' in params:
              query_params['inclusive_end'] = params['inclusive_end']
          if 'show_zero_cost' in params:
              query_params['show_zero_cost'] = params['show_zero_cost']
          if 'show_plan_only_when_ambiguous' in params:
              query_params['show_plan_only_when_ambiguous'] = params['show_plan_only_when_ambiguous']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/html'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='str',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_as_pdf(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"PDF Invoice\",\"response\" : \"getInvoiceByID.pdf\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_as_pdf(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool tier_breakdown: Whether to provide a breakdown of charge tiering.
          :param bool inclusive_end: Whether to present in the Invoice date range only those dates whose entirety are involved in the billing period. In other words: when true, this subtracts 1 from the \"period end\" date shown to the customer.
          :param bool show_zero_cost: Whether to show zero-cost lines.
          :param bool show_plan_only_when_ambiguous: Whether to state which plan the Invoice lines came from, regardless of whether there's only one plan involved in this Invoice.
          :param bool include_footer: 
          :param str group_line_items_by: 
          :return: file
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_as_pdf_with_http_info(id, **kwargs)
          else:
              (data) = self.get_invoice_as_pdf_with_http_info(id, **kwargs)
              return data
  
      def get_invoice_as_pdf_with_http_info(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"PDF Invoice\",\"response\" : \"getInvoiceByID.pdf\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_as_pdf_with_http_info(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool tier_breakdown: Whether to provide a breakdown of charge tiering.
          :param bool inclusive_end: Whether to present in the Invoice date range only those dates whose entirety are involved in the billing period. In other words: when true, this subtracts 1 from the \"period end\" date shown to the customer.
          :param bool show_zero_cost: Whether to show zero-cost lines.
          :param bool show_plan_only_when_ambiguous: Whether to state which plan the Invoice lines came from, regardless of whether there's only one plan involved in this Invoice.
          :param bool include_footer: 
          :param str group_line_items_by: 
          :return: file
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'tier_breakdown', 'inclusive_end', 'show_zero_cost', 'show_plan_only_when_ambiguous', 'include_footer', 'group_line_items_by']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_as_pdf" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'id' is set
          if ('id' not in params) or (params['id'] is None):
              raise ValueError("Missing the required parameter `id` when calling `get_invoice_as_pdf`")
  
          resource_path = '/invoices/{ID}.pdf'.replace('{format}', 'json')
          path_params = {}
          if 'id' in params:
              path_params['ID'] = params['id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'tier_breakdown' in params:
              query_params['tier_breakdown'] = params['tier_breakdown']
          if 'inclusive_end' in params:
              query_params['inclusive_end'] = params['inclusive_end']
          if 'show_zero_cost' in params:
              query_params['show_zero_cost'] = params['show_zero_cost']
          if 'show_plan_only_when_ambiguous' in params:
              query_params['show_plan_only_when_ambiguous'] = params['show_plan_only_when_ambiguous']
          if 'include_footer' in params:
              query_params['include_footer'] = params['include_footer']
          if 'group_line_items_by' in params:
              query_params['group_line_items_by'] = params['group_line_items_by']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/pdf'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='file',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_by_id(self, invoice_id, **kwargs):
          """
          Retrieves a single invoice specified by the invoice-ID parameter.
          { \"nickname\" : \"Retrieve an existing invoice\",\"response\" : \"getInvoiceByID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_id(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_by_id_with_http_info(invoice_id, **kwargs)
          else:
              (data) = self.get_invoice_by_id_with_http_info(invoice_id, **kwargs)
              return data
  
      def get_invoice_by_id_with_http_info(self, invoice_id, **kwargs):
          """
          Retrieves a single invoice specified by the invoice-ID parameter.
          { \"nickname\" : \"Retrieve an existing invoice\",\"response\" : \"getInvoiceByID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_id_with_http_info(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'exclude_children']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_by_id" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `get_invoice_by_id`")
  
          resource_path = '/invoices/{invoice-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'exclude_children' in params:
              query_params['exclude_children'] = params['exclude_children']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_by_id_as_csv(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"CSV invoice\",\"response\" : \"getInvoiceByID.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_id_as_csv(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_by_id_as_csv_with_http_info(id, **kwargs)
          else:
              (data) = self.get_invoice_by_id_as_csv_with_http_info(id, **kwargs)
              return data
  
      def get_invoice_by_id_as_csv_with_http_info(self, id, **kwargs):
          """
          Retrieves a single invoice specified by the ID parameter.
          { \"nickname\" : \"CSV invoice\",\"response\" : \"getInvoiceByID.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_id_as_csv_with_http_info(id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str id: The ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_by_id_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'id' is set
          if ('id' not in params) or (params['id'] is None):
              raise ValueError("Missing the required parameter `id` when calling `get_invoice_by_id_as_csv`")
  
          resource_path = '/invoices/{ID}.csv'.replace('{format}', 'json')
          path_params = {}
          if 'id' in params:
              path_params['ID'] = params['id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='str',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_by_subscription_id(self, subscription_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the subscription-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by subscription\",\"response\" : \"getInvoiceBySubscriptionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_subscription_id(subscription_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str subscription_id: ID of the subscription. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_by_subscription_id_with_http_info(subscription_id, **kwargs)
          else:
              (data) = self.get_invoice_by_subscription_id_with_http_info(subscription_id, **kwargs)
              return data
  
      def get_invoice_by_subscription_id_with_http_info(self, subscription_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the subscription-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by subscription\",\"response\" : \"getInvoiceBySubscriptionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_subscription_id_with_http_info(subscription_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str subscription_id: ID of the subscription. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['subscription_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'exclude_children']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_by_subscription_id" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'subscription_id' is set
          if ('subscription_id' not in params) or (params['subscription_id'] is None):
              raise ValueError("Missing the required parameter `subscription_id` when calling `get_invoice_by_subscription_id`")
  
          resource_path = '/invoices/subscription/{subscription-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'subscription_id' in params:
              path_params['subscription-ID'] = params['subscription_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'exclude_children' in params:
              query_params['exclude_children'] = params['exclude_children']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_by_subscription_version_id(self, subscription_version_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the subscription-version-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by subscription version\",\"response\" : \"getInvoiceBySubscriptionVersionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_subscription_version_id(subscription_version_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str subscription_version_id: Version ID of the subscription. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_by_subscription_version_id_with_http_info(subscription_version_id, **kwargs)
          else:
              (data) = self.get_invoice_by_subscription_version_id_with_http_info(subscription_version_id, **kwargs)
              return data
  
      def get_invoice_by_subscription_version_id_with_http_info(self, subscription_version_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the subscription-version-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by subscription version\",\"response\" : \"getInvoiceBySubscriptionVersionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_subscription_version_id_with_http_info(subscription_version_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str subscription_version_id: Version ID of the subscription. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['subscription_version_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'exclude_children']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_by_subscription_version_id" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'subscription_version_id' is set
          if ('subscription_version_id' not in params) or (params['subscription_version_id'] is None):
              raise ValueError("Missing the required parameter `subscription_version_id` when calling `get_invoice_by_subscription_version_id`")
  
          resource_path = '/invoices/subscription/version/{subscription-version-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'subscription_version_id' in params:
              path_params['subscription-version-ID'] = params['subscription_version_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'exclude_children' in params:
              query_params['exclude_children'] = params['exclude_children']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoice_by_version_id(self, version_id, **kwargs):
          """
          Retrieves a single invoice, specified by the version-ID parameter.
          { \"nickname\" : \"Retrieve by version\",\"response\" : \"getInvoiceByVersionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_version_id(version_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str version_id: The version-ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoice_by_version_id_with_http_info(version_id, **kwargs)
          else:
              (data) = self.get_invoice_by_version_id_with_http_info(version_id, **kwargs)
              return data
  
      def get_invoice_by_version_id_with_http_info(self, version_id, **kwargs):
          """
          Retrieves a single invoice, specified by the version-ID parameter.
          { \"nickname\" : \"Retrieve by version\",\"response\" : \"getInvoiceByVersionID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoice_by_version_id_with_http_info(version_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str version_id: The version-ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['version_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoice_by_version_id" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'version_id' is set
          if ('version_id' not in params) or (params['version_id'] is None):
              raise ValueError("Missing the required parameter `version_id` when calling `get_invoice_by_version_id`")
  
          resource_path = '/invoices/version/{version-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'version_id' in params:
              path_params['version-ID'] = params['version_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json', 'text/xml'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_account_id(self, account_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the account-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by account\",\"response\" : \"getInvoiceByAccountID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_account_id(account_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str account_id: ID of the account. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_account_id_with_http_info(account_id, **kwargs)
          else:
              (data) = self.get_invoices_by_account_id_with_http_info(account_id, **kwargs)
              return data
  
      def get_invoices_by_account_id_with_http_info(self, account_id, **kwargs):
          """
          Retrieves a collection of invoices specified by the account-ID parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by account\",\"response\" : \"getInvoiceByAccountID.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_account_id_with_http_info(account_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str account_id: ID of the account. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first invoice to return.
          :param int records: The maximum number of invoices to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :param bool exclude_children: Should child invoices be excluded.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['account_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired', 'exclude_children']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_account_id" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'account_id' is set
          if ('account_id' not in params) or (params['account_id'] is None):
              raise ValueError("Missing the required parameter `account_id` when calling `get_invoices_by_account_id`")
  
          resource_path = '/invoices/account/{account-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'account_id' in params:
              path_params['account-ID'] = params['account_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
          if 'exclude_children' in params:
              query_params['exclude_children'] = params['exclude_children']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_period_end(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-end times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-end\",\"response\" : \"getInvoiceByPeriodEnd.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_end(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_period_end_with_http_info(lower_threshold, upper_threshold, **kwargs)
          else:
              (data) = self.get_invoices_by_period_end_with_http_info(lower_threshold, upper_threshold, **kwargs)
              return data
  
      def get_invoices_by_period_end_with_http_info(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-end times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-end\",\"response\" : \"getInvoiceByPeriodEnd.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_end_with_http_info(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['lower_threshold', 'upper_threshold', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_period_end" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'lower_threshold' is set
          if ('lower_threshold' not in params) or (params['lower_threshold'] is None):
              raise ValueError("Missing the required parameter `lower_threshold` when calling `get_invoices_by_period_end`")
          # verify the required parameter 'upper_threshold' is set
          if ('upper_threshold' not in params) or (params['upper_threshold'] is None):
              raise ValueError("Missing the required parameter `upper_threshold` when calling `get_invoices_by_period_end`")
  
          resource_path = '/invoices/period-end/{lower-threshold}/{upper-threshold}'.replace('{format}', 'json')
          path_params = {}
          if 'lower_threshold' in params:
              path_params['lower-threshold'] = params['lower_threshold']
          if 'upper_threshold' in params:
              path_params['upper-threshold'] = params['upper_threshold']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_period_start(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-start\",\"response\" : \"getInvoiceByPeriodStart.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_start(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_period_start_with_http_info(lower_threshold, upper_threshold, **kwargs)
          else:
              (data) = self.get_invoices_by_period_start_with_http_info(lower_threshold, upper_threshold, **kwargs)
              return data
  
      def get_invoices_by_period_start_with_http_info(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-start\",\"response\" : \"getInvoiceByPeriodStart.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_start_with_http_info(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['lower_threshold', 'upper_threshold', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_period_start" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'lower_threshold' is set
          if ('lower_threshold' not in params) or (params['lower_threshold'] is None):
              raise ValueError("Missing the required parameter `lower_threshold` when calling `get_invoices_by_period_start`")
          # verify the required parameter 'upper_threshold' is set
          if ('upper_threshold' not in params) or (params['upper_threshold'] is None):
              raise ValueError("Missing the required parameter `upper_threshold` when calling `get_invoices_by_period_start`")
  
          resource_path = '/invoices/period-start/{lower-threshold}/{upper-threshold}'.replace('{format}', 'json')
          path_params = {}
          if 'lower_threshold' in params:
              path_params['lower-threshold'] = params['lower_threshold']
          if 'upper_threshold' in params:
              path_params['upper-threshold'] = params['upper_threshold']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_period_start_as_csv(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-start\",\"response\" : \"getInvoiceByPeriodStart.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_start_as_csv(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_period_start_as_csv_with_http_info(lower_threshold, upper_threshold, **kwargs)
          else:
              (data) = self.get_invoices_by_period_start_as_csv_with_http_info(lower_threshold, upper_threshold, **kwargs)
              return data
  
      def get_invoices_by_period_start_as_csv_with_http_info(self, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by period-start\",\"response\" : \"getInvoiceByPeriodStart.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_period_start_as_csv_with_http_info(lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['lower_threshold', 'upper_threshold', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_period_start_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'lower_threshold' is set
          if ('lower_threshold' not in params) or (params['lower_threshold'] is None):
              raise ValueError("Missing the required parameter `lower_threshold` when calling `get_invoices_by_period_start_as_csv`")
          # verify the required parameter 'upper_threshold' is set
          if ('upper_threshold' not in params) or (params['upper_threshold'] is None):
              raise ValueError("Missing the required parameter `upper_threshold` when calling `get_invoices_by_period_start_as_csv`")
  
          resource_path = '/invoices/period-start/{lower-threshold}/{upper-threshold}.csv'.replace('{format}', 'json')
          path_params = {}
          if 'lower_threshold' in params:
              path_params['lower-threshold'] = params['lower_threshold']
          if 'upper_threshold' in params:
              path_params['upper-threshold'] = params['upper_threshold']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_state(self, state, **kwargs):
          """
          Retrieves a collection of invoices, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state\",\"response\" : \"getInvoiceByState.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state(state, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_state_with_http_info(state, **kwargs)
          else:
              (data) = self.get_invoices_by_state_with_http_info(state, **kwargs)
              return data
  
      def get_invoices_by_state_with_http_info(self, state, **kwargs):
          """
          Retrieves a collection of invoices, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state\",\"response\" : \"getInvoiceByState.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_with_http_info(state, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['state', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_state" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'state' is set
          if ('state' not in params) or (params['state'] is None):
              raise ValueError("Missing the required parameter `state` when calling `get_invoices_by_state`")
  
          resource_path = '/invoices/state/{state}'.replace('{format}', 'json')
          path_params = {}
          if 'state' in params:
              path_params['state'] = params['state']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_state_and_period_start(self, state, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects specified by the state parameter and with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state and period-start\",\"response\" : \"getInvoiceByStateAndPeriodStart.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_and_period_start(state, lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_state_and_period_start_with_http_info(state, lower_threshold, upper_threshold, **kwargs)
          else:
              (data) = self.get_invoices_by_state_and_period_start_with_http_info(state, lower_threshold, upper_threshold, **kwargs)
              return data
  
      def get_invoices_by_state_and_period_start_with_http_info(self, state, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects specified by the state parameter and with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state and period-start\",\"response\" : \"getInvoiceByStateAndPeriodStart.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_and_period_start_with_http_info(state, lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['state', 'lower_threshold', 'upper_threshold', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_state_and_period_start" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'state' is set
          if ('state' not in params) or (params['state'] is None):
              raise ValueError("Missing the required parameter `state` when calling `get_invoices_by_state_and_period_start`")
          # verify the required parameter 'lower_threshold' is set
          if ('lower_threshold' not in params) or (params['lower_threshold'] is None):
              raise ValueError("Missing the required parameter `lower_threshold` when calling `get_invoices_by_state_and_period_start`")
          # verify the required parameter 'upper_threshold' is set
          if ('upper_threshold' not in params) or (params['upper_threshold'] is None):
              raise ValueError("Missing the required parameter `upper_threshold` when calling `get_invoices_by_state_and_period_start`")
  
          resource_path = '/invoices/state/{state}/period-start/{lower-threshold}/{upper-threshold}'.replace('{format}', 'json')
          path_params = {}
          if 'state' in params:
              path_params['state'] = params['state']
          if 'lower_threshold' in params:
              path_params['lower-threshold'] = params['lower_threshold']
          if 'upper_threshold' in params:
              path_params['upper-threshold'] = params['upper_threshold']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_state_and_period_start_as_csv(self, state, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects specified by the state parameter and with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state and period-start\",\"response\" : \"getInvoiceByStateAndPeriodStart.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_and_period_start_as_csv(state, lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_state_and_period_start_as_csv_with_http_info(state, lower_threshold, upper_threshold, **kwargs)
          else:
              (data) = self.get_invoices_by_state_and_period_start_as_csv_with_http_info(state, lower_threshold, upper_threshold, **kwargs)
              return data
  
      def get_invoices_by_state_and_period_start_as_csv_with_http_info(self, state, lower_threshold, upper_threshold, **kwargs):
          """
          Retrieves a collection of invoice objects specified by the state parameter and with period-start times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state and period-start\",\"response\" : \"getInvoiceByStateAndPeriodStart.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_and_period_start_as_csv_with_http_info(state, lower_threshold, upper_threshold, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param str lower_threshold: The UTC DateTime specifying the start of the result period. (required)
          :param str upper_threshold: The UTC DateTime specifying the end of the result period. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first taxation-link to return.
          :param int records: The maximum number of taxation-links to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['state', 'lower_threshold', 'upper_threshold', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_state_and_period_start_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'state' is set
          if ('state' not in params) or (params['state'] is None):
              raise ValueError("Missing the required parameter `state` when calling `get_invoices_by_state_and_period_start_as_csv`")
          # verify the required parameter 'lower_threshold' is set
          if ('lower_threshold' not in params) or (params['lower_threshold'] is None):
              raise ValueError("Missing the required parameter `lower_threshold` when calling `get_invoices_by_state_and_period_start_as_csv`")
          # verify the required parameter 'upper_threshold' is set
          if ('upper_threshold' not in params) or (params['upper_threshold'] is None):
              raise ValueError("Missing the required parameter `upper_threshold` when calling `get_invoices_by_state_and_period_start_as_csv`")
  
          resource_path = '/invoices/state/{state}/period-start/{lower-threshold}/{upper-threshold}.csv'.replace('{format}', 'json')
          path_params = {}
          if 'state' in params:
              path_params['state'] = params['state']
          if 'lower_threshold' in params:
              path_params['lower-threshold'] = params['lower_threshold']
          if 'upper_threshold' in params:
              path_params['upper-threshold'] = params['upper_threshold']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_invoices_by_state_as_csv(self, state, **kwargs):
          """
          Retrieves a collection of invoices, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state\",\"response\" : \"getInvoiceByState.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_as_csv(state, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_invoices_by_state_as_csv_with_http_info(state, **kwargs)
          else:
              (data) = self.get_invoices_by_state_as_csv_with_http_info(state, **kwargs)
              return data
  
      def get_invoices_by_state_as_csv_with_http_info(self, state, **kwargs):
          """
          Retrieves a collection of invoices, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
          { \"nickname\" : \"Retrieve by state\",\"response\" : \"getInvoiceByState.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_invoices_by_state_as_csv_with_http_info(state, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str state: The current state of the invoice, either Paid, Pending,  Unpaid or Voided. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The offset from the first subscription to return.
          :param int records: The maximum number of subscriptions to return.
          :param str order_by: Specify a field used to order the result set.
          :param str order: Ihe direction of any ordering, either ASC or DESC.
          :param bool include_retired: Whether retired products should be returned.
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['state', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_invoices_by_state_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'state' is set
          if ('state' not in params) or (params['state'] is None):
              raise ValueError("Missing the required parameter `state` when calling `get_invoices_by_state_as_csv`")
  
          resource_path = '/invoices/state/{state}.csv'.replace('{format}', 'json')
          path_params = {}
          if 'state' in params:
              path_params['state'] = params['state']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'order_by' in params:
              query_params['order_by'] = params['order_by']
          if 'order' in params:
              query_params['order'] = params['order']
          if 'include_retired' in params:
              query_params['include_retired'] = params['include_retired']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_line_payments(self, **kwargs):
          """
          Retrieves all InvoiceLine payment attributions.
          { \"nickname\" : \"Retrieve InvoiceLine payment attributions\",\"response\" : \"getInvoiceLinePayments.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_line_payments(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which line payment attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which line payment attributions will be recognised (example input: 2015-10-13T11:50:24).
          :param list[str] include_gateway: Include attributions only from payments made via these payment gateways. Takes precedence over `exclude_gateway` param (if both are provided).
          :param list[str] exclude_gateway: Include attributions from payments made via all payment gateways, except these.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_line_payments_with_http_info(**kwargs)
          else:
              (data) = self.get_line_payments_with_http_info(**kwargs)
              return data
  
      def get_line_payments_with_http_info(self, **kwargs):
          """
          Retrieves all InvoiceLine payment attributions.
          { \"nickname\" : \"Retrieve InvoiceLine payment attributions\",\"response\" : \"getInvoiceLinePayments.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_line_payments_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which line payment attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which line payment attributions will be recognised (example input: 2015-10-13T11:50:24).
          :param list[str] include_gateway: Include attributions only from payments made via these payment gateways. Takes precedence over `exclude_gateway` param (if both are provided).
          :param list[str] exclude_gateway: Include attributions from payments made via all payment gateways, except these.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end', 'include_gateway', 'exclude_gateway']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_line_payments" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/line-payments'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
          if 'include_gateway' in params:
              query_params['include_gateway'] = params['include_gateway']
          if 'exclude_gateway' in params:
              query_params['exclude_gateway'] = params['exclude_gateway']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept([])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type([])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_line_payments_as_csv(self, **kwargs):
          """
          Retrieves (as CSV) all InvoiceLine payment attributions.
          { \"nickname\" : \"(CSV) Retrieve InvoiceLine payment attributions\",\"response\" : \"getInvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_line_payments_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which line payment attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which line payment attributions will be recognised (example input: 2015-10-13T11:50:24).
          :param list[str] include_gateway: Include attributions only from payments made via these payment gateways. Takes precedence over `exclude_gateway` param (if both are provided).
          :param list[str] exclude_gateway: Include attributions from payments made via all payment gateways, except these.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_line_payments_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_line_payments_as_csv_with_http_info(**kwargs)
              return data
  
      def get_line_payments_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves (as CSV) all InvoiceLine payment attributions.
          { \"nickname\" : \"(CSV) Retrieve InvoiceLine payment attributions\",\"response\" : \"getInvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_line_payments_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which line payment attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which line payment attributions will be recognised (example input: 2015-10-13T11:50:24).
          :param list[str] include_gateway: Include attributions only from payments made via these payment gateways. Takes precedence over `exclude_gateway` param (if both are provided).
          :param list[str] exclude_gateway: Include attributions from payments made via all payment gateways, except these.
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end', 'include_gateway', 'exclude_gateway']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_line_payments_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/line-payments.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
          if 'include_gateway' in params:
              query_params['include_gateway'] = params['include_gateway']
          if 'exclude_gateway' in params:
              query_params['exclude_gateway'] = params['exclude_gateway']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept([])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type([])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_metadata_for_invoice(self, invoice_id, **kwargs):
          """
          Retrieve any associated metadata.
          {\"nickname\":\"Retrieve metadata on invoice\",\"request\":\"getInvoiceMetadataRequest.html\",\"response\":\"getInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_metadata_for_invoice(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_metadata_for_invoice_with_http_info(invoice_id, **kwargs)
          else:
              (data) = self.get_metadata_for_invoice_with_http_info(invoice_id, **kwargs)
              return data
  
      def get_metadata_for_invoice_with_http_info(self, invoice_id, **kwargs):
          """
          Retrieve any associated metadata.
          {\"nickname\":\"Retrieve metadata on invoice\",\"request\":\"getInvoiceMetadataRequest.html\",\"response\":\"getInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_metadata_for_invoice_with_http_info(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_metadata_for_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `get_metadata_for_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/metadata'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='DynamicMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_refund_invoice_line_payments_from_invoices_as_csv(self, **kwargs):
          """
          Retrieves awarded refunds from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Refund InvoiceLinePayments CSV\",\"response\" : \"Refund InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_refund_invoice_line_payments_from_invoices_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which refunds will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which refunds will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_refund_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_refund_invoice_line_payments_from_invoices_as_csv_with_http_info(**kwargs)
              return data
  
      def get_refund_invoice_line_payments_from_invoices_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves awarded refunds from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Refund InvoiceLinePayments CSV\",\"response\" : \"Refund InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_refund_invoice_line_payments_from_invoices_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which refunds will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which refunds will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_refund_invoice_line_payments_from_invoices_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/refund.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received(self, **kwargs):
          """
          Retrieves awarded refunds from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Refund InvoiceLinePayments CSV\",\"response\" : \"Refund InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which refunds will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which refunds will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received_with_http_info(**kwargs)
          else:
              (data) = self.get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received_with_http_info(**kwargs)
              return data
  
      def get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received_with_http_info(self, **kwargs):
          """
          Retrieves awarded refunds from InvoicePayments upon line items, in CSV format.
          { \"nickname\" : \"Refund InvoiceLinePayments CSV\",\"response\" : \"Refund InvoiceLinePayments.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which refunds will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which refunds will be recognised (example input: 2015-10-13T11:50:24).
          :return: InvoiceLinePaymentPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_refund_invoice_line_payments_from_invoices_as_csv_by_refund_received" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/payment-received/refund.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/csv'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoiceLinePaymentPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_revenue_attributions(self, **kwargs):
          """
          Retrieves all attributions of Invoice costs to Invoice lines.
          { \"nickname\" : \"Retrieve revenue attributions\",\"response\" : \"getRevenueAttributions.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_revenue_attributions(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: RevenueAttributionPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_revenue_attributions_with_http_info(**kwargs)
          else:
              (data) = self.get_revenue_attributions_with_http_info(**kwargs)
              return data
  
      def get_revenue_attributions_with_http_info(self, **kwargs):
          """
          Retrieves all attributions of Invoice costs to Invoice lines.
          { \"nickname\" : \"Retrieve revenue attributions\",\"response\" : \"getRevenueAttributions.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_revenue_attributions_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: RevenueAttributionPagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_revenue_attributions" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/revenue-attributions'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept([])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type([])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='RevenueAttributionPagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_revenue_attributions_as_csv(self, **kwargs):
          """
          Retrieves (as CSV) all attributions of Invoice costs to Invoice lines.
          { \"nickname\" : \"(CSV) Retrieve revenue attributions\",\"response\" : \"getRevenueAttributions.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_revenue_attributions_as_csv(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_revenue_attributions_as_csv_with_http_info(**kwargs)
          else:
              (data) = self.get_revenue_attributions_as_csv_with_http_info(**kwargs)
              return data
  
      def get_revenue_attributions_as_csv_with_http_info(self, **kwargs):
          """
          Retrieves (as CSV) all attributions of Invoice costs to Invoice lines.
          { \"nickname\" : \"(CSV) Retrieve revenue attributions\",\"response\" : \"getRevenueAttributions.csv\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_revenue_attributions_as_csv_with_http_info(callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param str recognition_start: The UTC DateTime specifying the start of the interval within which revenue attributions will be recognised (example input: 2015-09-13T11:50:24).
          :param str recognition_end: The UTC DateTime specifying the end of the interval within which revenue attributions will be recognised (example input: 2015-10-13T11:50:24).
          :return: str
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['organizations', 'recognition_start', 'recognition_end']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_revenue_attributions_as_csv" % key
                  )
              params[key] = val
          del params['kwargs']
  
          resource_path = '/invoices/revenue-attributions.csv'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'recognition_start' in params:
              query_params['recognition_start'] = params['recognition_start']
          if 'recognition_end' in params:
              query_params['recognition_end'] = params['recognition_end']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept([])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type([])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='str',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def get_swagger_for_invoice(self, query_string, **kwargs):
          """
          
          { \"nickname\" : \"\",\"response\" : \"\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_swagger_for_invoice(query_string, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str query_string: The query string used to search. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The starting index of the search results.
          :param int records: The number of search results to return.
          :param str format: The response format, either JSON or XML.
          :param bool wildcard: Toggle if we search for full words or whether a wildcard is used.
          :param bool entity: Is an entity returned with the search results.
          :return: SwaggerTypeListInv
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.get_swagger_for_invoice_with_http_info(query_string, **kwargs)
          else:
              (data) = self.get_swagger_for_invoice_with_http_info(query_string, **kwargs)
              return data
  
      def get_swagger_for_invoice_with_http_info(self, query_string, **kwargs):
          """
          
          { \"nickname\" : \"\",\"response\" : \"\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.get_swagger_for_invoice_with_http_info(query_string, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str query_string: The query string used to search. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :param int offset: The starting index of the search results.
          :param int records: The number of search results to return.
          :param str format: The response format, either JSON or XML.
          :param bool wildcard: Toggle if we search for full words or whether a wildcard is used.
          :param bool entity: Is an entity returned with the search results.
          :return: SwaggerTypeListInv
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['query_string', 'organizations', 'offset', 'records', 'format', 'wildcard', 'entity']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method get_swagger_for_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'query_string' is set
          if ('query_string' not in params) or (params['query_string'] is None):
              raise ValueError("Missing the required parameter `query_string` when calling `get_swagger_for_invoice`")
  
          resource_path = '/invoices/swagger-end-point/{query-string}'.replace('{format}', 'json')
          path_params = {}
          if 'query_string' in params:
              path_params['query-string'] = params['query_string']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
          if 'offset' in params:
              query_params['offset'] = params['offset']
          if 'records' in params:
              query_params['records'] = params['records']
          if 'format' in params:
              query_params['format'] = params['format']
          if 'wildcard' in params:
              query_params['wildcard'] = params['wildcard']
          if 'entity' in params:
              query_params['entity'] = params['entity']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'GET',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='SwaggerTypeListInv',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def import_invoice(self, request, **kwargs):
          """
          Import an invoice.
          {\"nickname\":\"Import invoice\",\"response\":\"ImportInvoiceResponse.html\",\"request\":\"ImportInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.import_invoice(request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.import_invoice_with_http_info(request, **kwargs)
          else:
              (data) = self.import_invoice_with_http_info(request, **kwargs)
              return data
  
      def import_invoice_with_http_info(self, request, **kwargs):
          """
          Import an invoice.
          {\"nickname\":\"Import invoice\",\"response\":\"ImportInvoiceResponse.html\",\"request\":\"ImportInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.import_invoice_with_http_info(request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param BillingEntityBase request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['request']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method import_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'request' is set
          if ('request' not in params) or (params['request'] is None):
              raise ValueError("Missing the required parameter `request` when calling `import_invoice`")
  
          resource_path = '/invoices/import'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'request' in params:
              body_params = params['request']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def recalculate_invoice(self, invoice_id, request, **kwargs):
          """
          Re-calculate an Invoice.
          {\"nickname\":\"Re-calculate an invoice\",\"response\":\"recalculateInvoiceResponse.html\",\"request\":\"RecalculateInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.recalculate_invoice(invoice_id, request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param InvoiceRecalculationRequest request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.recalculate_invoice_with_http_info(invoice_id, request, **kwargs)
          else:
              (data) = self.recalculate_invoice_with_http_info(invoice_id, request, **kwargs)
              return data
  
      def recalculate_invoice_with_http_info(self, invoice_id, request, **kwargs):
          """
          Re-calculate an Invoice.
          {\"nickname\":\"Re-calculate an invoice\",\"response\":\"recalculateInvoiceResponse.html\",\"request\":\"RecalculateInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.recalculate_invoice_with_http_info(invoice_id, request, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param InvoiceRecalculationRequest request:  (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'request']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method recalculate_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `recalculate_invoice`")
          # verify the required parameter 'request' is set
          if ('request' not in params) or (params['request'] is None):
              raise ValueError("Missing the required parameter `request` when calling `recalculate_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/recalculate'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'request' in params:
              body_params = params['request']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def remove_charge_from_invoice(self, invoice_id, charge_id, **kwargs):
          """
          Removes the specified charge from the specified Invoice.
          {\"nickname\":\"Remove from invoice\",\"response\":\"deleteChargesInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.remove_charge_from_invoice(invoice_id, charge_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param str charge_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.remove_charge_from_invoice_with_http_info(invoice_id, charge_id, **kwargs)
          else:
              (data) = self.remove_charge_from_invoice_with_http_info(invoice_id, charge_id, **kwargs)
              return data
  
      def remove_charge_from_invoice_with_http_info(self, invoice_id, charge_id, **kwargs):
          """
          Removes the specified charge from the specified Invoice.
          {\"nickname\":\"Remove from invoice\",\"response\":\"deleteChargesInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.remove_charge_from_invoice_with_http_info(invoice_id, charge_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param str charge_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: SubscriptionChargePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'charge_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method remove_charge_from_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `remove_charge_from_invoice`")
          # verify the required parameter 'charge_id' is set
          if ('charge_id' not in params) or (params['charge_id'] is None):
              raise ValueError("Missing the required parameter `charge_id` when calling `remove_charge_from_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/charges/{charge-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
          if 'charge_id' in params:
              path_params['charge-ID'] = params['charge_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'DELETE',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='SubscriptionChargePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def remove_metadata_from_invoice(self, invoice_id, **kwargs):
          """
          Remove any associated metadata.
          {\"nickname\":\"Clear metadata from invoice\",\"request\" :\"deleteInvoiceMetadataRequest.html\",\"response\":\"deleteInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.remove_metadata_from_invoice(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.remove_metadata_from_invoice_with_http_info(invoice_id, **kwargs)
          else:
              (data) = self.remove_metadata_from_invoice_with_http_info(invoice_id, **kwargs)
              return data
  
      def remove_metadata_from_invoice_with_http_info(self, invoice_id, **kwargs):
          """
          Remove any associated metadata.
          {\"nickname\":\"Clear metadata from invoice\",\"request\" :\"deleteInvoiceMetadataRequest.html\",\"response\":\"deleteInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.remove_metadata_from_invoice_with_http_info(invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method remove_metadata_from_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `remove_metadata_from_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/metadata'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'DELETE',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='DynamicMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def set_metadata_for_invoice(self, metadata, invoice_id, **kwargs):
          """
          Remove any existing metadata keys and create the provided data.
          {\"nickname\":\"Set metadata on invoice\",\"request\":\"setInvoiceMetadataRequest.html\",\"response\":\"setInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.set_metadata_for_invoice(metadata, invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param DynamicMetadata metadata:  (required)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.set_metadata_for_invoice_with_http_info(metadata, invoice_id, **kwargs)
          else:
              (data) = self.set_metadata_for_invoice_with_http_info(metadata, invoice_id, **kwargs)
              return data
  
      def set_metadata_for_invoice_with_http_info(self, metadata, invoice_id, **kwargs):
          """
          Remove any existing metadata keys and create the provided data.
          {\"nickname\":\"Set metadata on invoice\",\"request\":\"setInvoiceMetadataRequest.html\",\"response\":\"setInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.set_metadata_for_invoice_with_http_info(metadata, invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param DynamicMetadata metadata:  (required)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['metadata', 'invoice_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method set_metadata_for_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'metadata' is set
          if ('metadata' not in params) or (params['metadata'] is None):
              raise ValueError("Missing the required parameter `metadata` when calling `set_metadata_for_invoice`")
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `set_metadata_for_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/metadata'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'metadata' in params:
              body_params = params['metadata']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'POST',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='DynamicMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def update_invoice(self, invoice, **kwargs):
          """
          Update an Invoice.
          {\"nickname\":\"Update an invoice\",\"response\":\"updateInvoiceResponse.html\",\"request\":\"updateInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.update_invoice(invoice, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param Invoice invoice: The invoice object to be updated. (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.update_invoice_with_http_info(invoice, **kwargs)
          else:
              (data) = self.update_invoice_with_http_info(invoice, **kwargs)
              return data
  
      def update_invoice_with_http_info(self, invoice, **kwargs):
          """
          Update an Invoice.
          {\"nickname\":\"Update an invoice\",\"response\":\"updateInvoiceResponse.html\",\"request\":\"updateInvoiceRequest.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.update_invoice_with_http_info(invoice, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param Invoice invoice: The invoice object to be updated. (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method update_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice' is set
          if ('invoice' not in params) or (params['invoice'] is None):
              raise ValueError("Missing the required parameter `invoice` when calling `update_invoice`")
  
          resource_path = '/invoices'.replace('{format}', 'json')
          path_params = {}
  
          query_params = {}
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'invoice' in params:
              body_params = params['invoice']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['text/xml', 'application/xml', 'application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'PUT',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def upsert_metadata_for_invoice(self, metadata, invoice_id, **kwargs):
          """
          Update any existing metadata key-values and insert any new key-values, no keys will be removed.
          {\"nickname\":\"Upsert metadata on invoice\",\"request\":\"upsertInvoiceMetadataRequest.html\",\"response\":\"upsertInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.upsert_metadata_for_invoice(metadata, invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param DynamicMetadata metadata:  (required)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.upsert_metadata_for_invoice_with_http_info(metadata, invoice_id, **kwargs)
          else:
              (data) = self.upsert_metadata_for_invoice_with_http_info(metadata, invoice_id, **kwargs)
              return data
  
      def upsert_metadata_for_invoice_with_http_info(self, metadata, invoice_id, **kwargs):
          """
          Update any existing metadata key-values and insert any new key-values, no keys will be removed.
          {\"nickname\":\"Upsert metadata on invoice\",\"request\":\"upsertInvoiceMetadataRequest.html\",\"response\":\"upsertInvoiceMetadataResponse.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.upsert_metadata_for_invoice_with_http_info(metadata, invoice_id, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param DynamicMetadata metadata:  (required)
          :param str invoice_id:  (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
          :return: DynamicMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['metadata', 'invoice_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method upsert_metadata_for_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'metadata' is set
          if ('metadata' not in params) or (params['metadata'] is None):
              raise ValueError("Missing the required parameter `metadata` when calling `upsert_metadata_for_invoice`")
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `upsert_metadata_for_invoice`")
  
          resource_path = '/invoices/{invoice-ID}/metadata'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'metadata' in params:
              body_params = params['metadata']
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'PUT',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='DynamicMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  
      def void_invoice(self, invoice_id, organizations, **kwargs):
          """
          Voids the invoice specified by the invoice identifier parameter.
          { \"nickname\" : \"Void an invoice\",\"response\" : \"voidInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.void_invoice(invoice_id, organizations, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls. (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('callback'):
              return self.void_invoice_with_http_info(invoice_id, organizations, **kwargs)
          else:
              (data) = self.void_invoice_with_http_info(invoice_id, organizations, **kwargs)
              return data
  
      def void_invoice_with_http_info(self, invoice_id, organizations, **kwargs):
          """
          Voids the invoice specified by the invoice identifier parameter.
          { \"nickname\" : \"Void an invoice\",\"response\" : \"voidInvoice.html\"}
  
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please define a `callback` function
          to be invoked when receiving the response.
          >>> def callback_function(response):
          >>>     pprint(response)
          >>>
          >>> thread = api.void_invoice_with_http_info(invoice_id, organizations, callback=callback_function)
  
          :param callback function: The callback function
              for asynchronous request. (optional)
          :param str invoice_id: ID of the invoice. (required)
          :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls. (required)
          :return: InvoicePagedMetadata
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['invoice_id', 'organizations']
          all_params.append('callback')
          all_params.append('_return_http_data_only')
  
          params = locals()
          for key, val in iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method void_invoice" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'invoice_id' is set
          if ('invoice_id' not in params) or (params['invoice_id'] is None):
              raise ValueError("Missing the required parameter `invoice_id` when calling `void_invoice`")
          # verify the required parameter 'organizations' is set
          if ('organizations' not in params) or (params['organizations'] is None):
              raise ValueError("Missing the required parameter `organizations` when calling `void_invoice`")
  
          resource_path = '/invoices/{invoice-ID}'.replace('{format}', 'json')
          path_params = {}
          if 'invoice_id' in params:
              path_params['invoice-ID'] = params['invoice_id']
  
          query_params = {}
          if 'organizations' in params:
              query_params['organizations'] = params['organizations']
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
  
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.\
              select_header_accept(['application/json'])
          if not header_params['Accept']:
              del header_params['Accept']
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.\
              select_header_content_type(['text/plain', 'application/json'])
  
          # Authentication setting
          auth_settings = []
  
          return self.api_client.call_api(resource_path, 'DELETE',
                                              path_params,
                                              query_params,
                                              header_params,
                                              body=body_params,
                                              post_params=form_params,
                                              files=local_var_files,
                                              response_type='InvoicePagedMetadata',
                                              auth_settings=auth_settings,
                                              callback=params.get('callback'),
                                              _return_http_data_only=params.get('_return_http_data_only'))
  