# coding: utf-8

"""
    Selling Partner API for Listings Items

    The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.  For more information, see the [Listings Items API Use Case Guide](doc:listings-items-api-v2021-08-01-use-case-guide).  # noqa: E501

    OpenAPI spec version: 2021-08-01
    
    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 src.api_models.listings_api.swagger_client.api_client import ApiClient


class ListingsApi(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 delete_listings_item(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """delete_listings_item  # noqa: E501

        Delete a listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.delete_listings_item(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
            return data

    def delete_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """delete_listings_item  # noqa: E501

        Delete a listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # 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(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # 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 get_listings_item(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """get_listings_item  # noqa: E501

        Returns details about a listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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_listings_item(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :param list[str] included_data: A comma-delimited list of data sets to include in the response. Default: summaries.
        :return: Item
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
        else:
            (data) = self.get_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
            return data

    def get_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """get_listings_item  # noqa: E501

        Returns details about a listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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_listings_item_with_http_info(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :param list[str] included_data: A comma-delimited list of data sets to include in the response. Default: summaries.
        :return: Item
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501
        if 'included_data' in params:
            query_params.append(('includedData', params['included_data']))  # noqa: E501
            collection_formats['includedData'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # 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(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Item',  # 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 patch_listings_item(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """patch_listings_item  # noqa: E501

        Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.patch_listings_item(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPatchRequest body: The request body schema for the patchListingsItem operation. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
        else:
            (data) = self.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
            return data

    def patch_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """patch_listings_item  # noqa: E501

        Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPatchRequest body: The request body schema for the patchListingsItem operation. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['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(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # 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 put_listings_item(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """put_listings_item  # noqa: E501

        Creates a new or fully-updates an existing listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.put_listings_item(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPutRequest body: The request body schema for the putListingsItem operation. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
        else:
            (data) = self.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
            return data

    def put_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """put_listings_item  # noqa: E501

        Creates a new or fully-updates an existing listings item for a selling partner.  **Note:** The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-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.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param list[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPutRequest body: The request body schema for the putListingsItem operation. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['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(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # 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)
