# coding: utf-8

"""
    Selling Partner API for Catalog Items

    The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.  # noqa: E501

    OpenAPI spec version: v0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from amazon_selling_partner_api.api_client import ApiClient


class DefaultApi(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):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def list_financial_event_groups(self, **kwargs):  # noqa: E501
        """list_financial_event_groups  # noqa: E501

        Returns financial event groups for a given date range.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_event_groups(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The maximum number of results to return per page.
        :param  : A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time  must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned.
        :param  : A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_financial_event_groups_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.list_financial_event_groups_with_http_info(**kwargs)  # noqa: E501
            return data

    def list_financial_event_groups_with_http_info(self, **kwargs):  # noqa: E501
        """list_financial_event_groups  # noqa: E501

        Returns financial event groups for a given date range.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_event_groups_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The maximum number of results to return per page.
        :param  : A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time  must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned.
        :param  : A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['', '', '', '']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_financial_event_groups" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if '' in params:
            query_params.append(('MaxResultsPerPage', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('FinancialEventGroupStartedBefore', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('FinancialEventGroupStartedAfter', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('NextToken', params['']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/finances/v0/financialEventGroups', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def list_financial_events(self, **kwargs):  # noqa: E501
        """list_financial_events  # noqa: E501

        Returns financial events for the specified data range.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The maximum number of results to return per page.
        :param  : A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format.
        :param  : A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_financial_events_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.list_financial_events_with_http_info(**kwargs)  # noqa: E501
            return data

    def list_financial_events_with_http_info(self, **kwargs):  # noqa: E501
        """list_financial_events  # noqa: E501

        Returns financial events for the specified data range.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The maximum number of results to return per page.
        :param  : A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format.
        :param  : A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['', '', '', '']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_financial_events" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if '' in params:
            query_params.append(('MaxResultsPerPage', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('PostedAfter', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('PostedBefore', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('NextToken', params['']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/finances/v0/financialEvents', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def list_financial_events_by_group_id(self, , **kwargs):  # noqa: E501
        """list_financial_events_by_group_id  # noqa: E501

        Returns all financial events for the specified financial event group.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events_by_group_id(, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The identifier of the financial event group to which the events belong. (required)
        :param  : The maximum number of results to return per page.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_financial_events_by_group_id_with_http_info(, **kwargs)  # noqa: E501
        else:
            (data) = self.list_financial_events_by_group_id_with_http_info(, **kwargs)  # noqa: E501
            return data

    def list_financial_events_by_group_id_with_http_info(self, , **kwargs):  # noqa: E501
        """list_financial_events_by_group_id  # noqa: E501

        Returns all financial events for the specified financial event group.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events_by_group_id_with_http_info(, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : The identifier of the financial event group to which the events belong. (required)
        :param  : The maximum number of results to return per page.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['', '', '']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_financial_events_by_group_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter '' is set
        if ('' not in params or
                params[''] is None):
            raise ValueError("Missing the required parameter `` when calling `list_financial_events_by_group_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if '' in params:
            path_params['eventGroupId'] = params['']  # noqa: E501

        query_params = []
        if '' in params:
            query_params.append(('MaxResultsPerPage', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('NextToken', params['']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/finances/v0/financialEventGroups/{eventGroupId}/financialEvents', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def list_financial_events_by_order_id(self, , **kwargs):  # noqa: E501
        """list_financial_events_by_order_id  # noqa: E501

        Returns all financial events for the specified order.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events_by_order_id(, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : An Amazon-defined order identifier, in 3-7-7 format. (required)
        :param  : The maximum number of results to return per page.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_financial_events_by_order_id_with_http_info(, **kwargs)  # noqa: E501
        else:
            (data) = self.list_financial_events_by_order_id_with_http_info(, **kwargs)  # noqa: E501
            return data

    def list_financial_events_by_order_id_with_http_info(self, , **kwargs):  # noqa: E501
        """list_financial_events_by_order_id  # noqa: E501

        Returns all financial events for the specified order.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_financial_events_by_order_id_with_http_info(, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param  : An Amazon-defined order identifier, in 3-7-7 format. (required)
        :param  : The maximum number of results to return per page.
        :param  : A string token returned in the response of your previous request.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['', '', '']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_financial_events_by_order_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter '' is set
        if ('' not in params or
                params[''] is None):
            raise ValueError("Missing the required parameter `` when calling `list_financial_events_by_order_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if '' in params:
            path_params['orderId'] = params['']  # noqa: E501

        query_params = []
        if '' in params:
            query_params.append(('MaxResultsPerPage', params['']))  # noqa: E501
        if '' in params:
            query_params.append(('NextToken', params['']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/finances/v0/orders/{orderId}/financialEvents', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
