# coding: utf-8

"""
    Selling Partner API for Pricing

    The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer pricing information for Amazon Marketplace products.  For more information, refer to the [Product Pricing v2022-05-01 Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-use-case-guide).

    The version of the OpenAPI document: 2022-05-01
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from spapi.api_client import ApiClient


class ProductPricingV2022Api(object):
    """NOTE: This class is auto generated by the openapi generator.

    Do not edit the class manually.
    """

    api_models_module = "spapi.models.product_pricing_v2022_05_01"

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.classFileName = 'product_pricing_v2022_api'

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

        Returns the competitive summary response, including featured buying options for the ASIN and `marketplaceId` combination.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.033 | 1 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_competitive_summary(requests, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CompetitiveSummaryBatchRequest requests: The batch of `getCompetitiveSummary` requests. (required)
        :return: CompetitiveSummaryBatchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_competitive_summary_with_http_info(requests, **kwargs)  # noqa: E501
        else:
            (data) = self.get_competitive_summary_with_http_info(requests, **kwargs)  # noqa: E501
            return data

    def get_competitive_summary_with_http_info(self, requests, **kwargs):  # noqa: E501
        """get_competitive_summary  # noqa: E501

        Returns the competitive summary response, including featured buying options for the ASIN and `marketplaceId` combination.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.033 | 1 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_competitive_summary_with_http_info(requests, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CompetitiveSummaryBatchRequest requests: The batch of `getCompetitiveSummary` requests. (required)
        :return: CompetitiveSummaryBatchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['requests']  # 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 get_competitive_summary" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'requests' is set
        if self.api_client.client_side_validation and ('requests' not in params or
                                                       params['requests'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `requests` when calling `get_competitive_summary`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'requests' in params:
            body_params = params['requests']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/batches/products/pricing/2022-05-01/items/competitiveSummary', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CompetitiveSummaryBatchResponse',  # 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, api_models_module=self.api_models_module)

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

        Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request body. The response for each successful (HTTP status code 200) request in the set includes the computed listing price at or below which a seller can expect to become the featured offer (before applicable promotions). This is called the featured offer expected price (FOEP). Featured offer is not guaranteed because competing offers might change. Other offers might be featured based on factors such as fulfillment capabilities to a specific customer. The response to an unsuccessful request includes the available error text.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.033 | 1 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_featured_offer_expected_price_batch(get_featured_offer_expected_price_batch_request_body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param GetFeaturedOfferExpectedPriceBatchRequest get_featured_offer_expected_price_batch_request_body: The batch of `getFeaturedOfferExpectedPrice` requests. (required)
        :return: GetFeaturedOfferExpectedPriceBatchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_featured_offer_expected_price_batch_with_http_info(get_featured_offer_expected_price_batch_request_body, **kwargs)  # noqa: E501
        else:
            (data) = self.get_featured_offer_expected_price_batch_with_http_info(get_featured_offer_expected_price_batch_request_body, **kwargs)  # noqa: E501
            return data

    def get_featured_offer_expected_price_batch_with_http_info(self, get_featured_offer_expected_price_batch_request_body, **kwargs):  # noqa: E501
        """get_featured_offer_expected_price_batch  # noqa: E501

        Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request body. The response for each successful (HTTP status code 200) request in the set includes the computed listing price at or below which a seller can expect to become the featured offer (before applicable promotions). This is called the featured offer expected price (FOEP). Featured offer is not guaranteed because competing offers might change. Other offers might be featured based on factors such as fulfillment capabilities to a specific customer. The response to an unsuccessful request includes the available error text.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.033 | 1 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_featured_offer_expected_price_batch_with_http_info(get_featured_offer_expected_price_batch_request_body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param GetFeaturedOfferExpectedPriceBatchRequest get_featured_offer_expected_price_batch_request_body: The batch of `getFeaturedOfferExpectedPrice` requests. (required)
        :return: GetFeaturedOfferExpectedPriceBatchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['get_featured_offer_expected_price_batch_request_body']  # 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 get_featured_offer_expected_price_batch" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'get_featured_offer_expected_price_batch_request_body' is set
        if self.api_client.client_side_validation and ('get_featured_offer_expected_price_batch_request_body' not in params or
                                                       params['get_featured_offer_expected_price_batch_request_body'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `get_featured_offer_expected_price_batch_request_body` when calling `get_featured_offer_expected_price_batch`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'get_featured_offer_expected_price_batch_request_body' in params:
            body_params = params['get_featured_offer_expected_price_batch_request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='GetFeaturedOfferExpectedPriceBatchResponse',  # 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, api_models_module=self.api_models_module)
