# coding: utf-8

"""
    Catalog API

    The Catalog API allows users to search for and locate an eBay catalog product that is a direct match for the product that they wish to sell. Listing against an eBay catalog product helps insure that all listings (based off of that catalog product) have complete and accurate information. In addition to helping to create high-quality listings, another benefit to the seller of using catalog information to create listings is that much of the details of the listing will be prefilled, including the listing title, the listing description, the item specifics, and a stock image for the product (if available). Sellers will not have to enter item specifics themselves, and the overall listing process is a lot faster and easier.  # noqa: E501

    OpenAPI spec version: v1_beta.5.0
    
    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 ...commerce_catalog.api_client import ApiClient


class ProductSummaryApi(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 search(self, **kwargs):  # noqa: E501
        """search  # noqa: E501

        This method searches for and retrieves summaries of one or more products in the eBay catalog that match the search criteria provided by a seller. The seller can use the summaries to select the product in the eBay catalog that corresponds to the item that the seller wants to offer for sale. When a corresponding product is found and adopted by the seller, eBay will use the product information to populate the item listing. The criteria supported by <b>search</b> include keywords, product categories, and category aspects. To see the full details of a selected product, use the <b>getProduct</b> call. <br /><br /> In addition to product summaries, this method can also be used to identify <i>refinements</i>, which help you to better pinpoint the product you're looking for. A refinement consists of one or more <i>aspect</i> values and a count of the number of times that each value has been used in previous eBay listings. An aspect is a property (e.g. color or size) of an eBay category, used by sellers to provide details about the items they're listing. The <b>refinement</b> container is returned when you include the <b>fieldGroups</b> query parameter in the request with a value of <code>ASPECT_REFINEMENTS</code> or <code>FULL</code>. <br /><br /> <span style=\"padding: 15px 20px; display: block; border: 1px solid #cccccc\"><b>Example</b> <br />A seller wants to find a product that is \"gray\" in color, but doesn't know what term the manufacturer uses for that color. It might be <code>Silver</code>, <code>Brushed Nickel</code>, <code>Pewter</code>, or even <code>Grey</code>. The returned <b>refinement</b> container identifies all aspects that have been used in past listings for products that match your search criteria, along with all of the values those aspects have taken, and the number of times each value was used. You can use this data to present the seller with a histogram of the values of each aspect. The seller can see which color values have been used in the past, and how frequently they have been used, and selects the most likely value or values for their product. You issue the <b>search</b> method again with those values in the <b>aspect_filter</b> parameter to narrow down the collection of products returned by the call.</span> <br /><br /> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. If you provide more than one of these parameters, they will be combined with a logical AND to further refine the returned collection of matching products. <br /><br /> <span class=\"tablenote\"><strong>Note:</strong> This method requires that certain special characters in the query parameters be percent-encoded: <br /><br /> &nbsp;&nbsp;&nbsp;&nbsp;<code>(space)</code> = <code>%20</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>,</code> = <code>%2C</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>:</code> = <code>%3A</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>[</code> = <code>%5B</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>]</code> = <code>%5D</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>{</code> = <code>%7B</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>|</code> = <code>%7C</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code> = <code>%7D</code> <br /><br /> This requirement applies to all query parameter values. However, for readability, method examples and samples in this documentation will not use the encoding.</span> <br /><br /> This method returns product summaries rather than the full details of the products. To retrieve the full details of a product, use the <b>getProduct</b> method with an ePID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str x_ebay_c_marketplace_id: This method also uses the <code>X-EBAY-C-MARKETPLACE-ID</code> header to identify the seller's eBay marketplace. It is required for all marketplaces except EBAY_US, which is the default. <b>Note:</b> This method is limited to <code>EBAY_US</code>, <code>EBAY_AU</code>, <code>EBAY_CA</code>, and <code>EBAY_GB</code> values.
        :param str aspect_filter: An eBay category and one or more aspects of that category, with the values that can be used to narrow down the collection of products returned by this call. <br /><br /> Aspects are product attributes that can represent different types of information for different products. Every product has aspects, but different products have different sets of aspects. <br /><br /> You can determine appropriate values for the aspects by first submitting this method without this parameter. It will return either the <b>productSummaries.aspects</b> container, the <b>refinement.aspectDistributions</b> container, or both, depending on the value of the <b>fieldgroups</b> parameter in the request. The <b>productSummaries.aspects</b> container provides the category aspects and their values that are associated with each returned product. The <b>refinement.aspectDistributions</b> container provides information about the distribution of values of the set of category aspects associated with the specified categories. In both cases sellers can select from among the returned aspects to use with this parameter. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> You can also use the Taxonomy API's <b>getItemAspectsForCategory</b> method to retrieve detailed information about aspects and their values that are appropriate for your selected category. </span> <br /><br /> The syntax for the <b>aspect_filter</b> parameter is as follows (on several lines for readability; <b>categoryId</b> is required): <br /><br /> <code>aspect_filter=categoryId:<i>category_id</i>,<br /> <i>aspect1</i>:{<i>valueA</i>|<i>valueB</i>|...},<br /> <i>aspect2</i>:{<i>valueC</i>|<i>valueD</i>|...},.</code> <br /><br /> A matching product must be within the specified category, and it must have least one of the values identified for every specified aspect. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Aspect names and values are case sensitive. </span> <br /><br /> Here is an example of an <b>aspect_filter</b> parameter in which <code>9355</code> is the category ID, <code>Color</code> is an aspect of that category, and <code>Black</code> and <code>White</code> are possible values of that aspect (on several lines for readability): <br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> aspect_filter=categoryId:9355,Color:{White|Black}</code>    <br /><br /> Here is the <b>aspect_filter</b> with required URL encoding and a second aspect (on several lines for readability): <br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> aspect_filter=categoryId:9355,Color:%7BWhite%7CBlack%7D,<br /> Storage%20Capacity:%128GB%7C256GB%7D</code> <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> You cannot use the <b>aspect_filter</b> parameter in the same method with either the <b>gtin</b> parameter or the <b>mpn</b> parameter. </span> For implementation help, refer to eBay API documentation at https://developer.ebay.com/api-docs/commerce/catalog/types/catal:AspectFilter
        :param str category_ids: <span class=\"tablenote\"> <strong>Important:</strong> Currently, only the first <b>category_id</b> value is accepted. </span> <br /><br /> One or more comma-separated category identifiers for narrowing down the collection of products returned by this call. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> This parameter requires a valid category ID value. You can use the Taxonomy API's <b>getCategorySuggestions</b> method to retrieve appropriate category IDs for your product based on keywords. </span> <br /><br /> The syntax for this parameter is as follows: <br /><br /> <code>category_ids=<i>category_id1</i>,<i>category_id2</i>,.</code> <br /><br /> Here is an example of a method with the <b>category_ids</b> parameter: br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> category_ids=178893</code> <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. <br /><br /> If you provide only the <b>category_ids</b> parameter, you cannot specify a top-level (L1) category. </span>
        :param str fieldgroups: The type of information to return in the response. <br /><br /> <span class=\"tablenote\"> <strong>Important:</strong> This parameter may not produce valid results if you also provide more than one value for the <b>category_ids</b> parameter. It is recommended that you avoid using this combination. </span> <br /><br /> <b> Valid Values: </b> <ul> <li><code>ASPECT_REFINEMENTS</code> &mdash; This returns the <b>refinement</b> container, which includes the category aspect and aspect value distributions that apply to the returned products. For example, if you searched for <code>Ford Mustang</code>, some of the category aspects might be <b>Model Year</b>, <b>Exterior Color</b>, <b>Vehicle Mileage</b>, and so on. <br /> <br /> <span class=\"tablenote\"> <b>Note: </b>Aspects are category specific.</span> </li> <li><code>FULL</code> &mdash; This returns all the refinement containers and all the matching products. This value overrides the other values, which will be ignored.</li> <li><code>MATCHING_PRODUCTS</code> &mdash; This returns summaries for all products that match the values you provide for the <b>q</b> and <b>category_ids</b> parameters. This does not affect your use of the <code>ASPECT_REFINEMENTS</code> value, which you can use in the same call.</li> </ul> Code so that your app gracefully handles any future changes to this list. <br /><br /><b>Default: </b> <code>MATCHING_PRODUCTS</code>
        :param str gtin: A string consisting of one or more comma-separated Global Trade Item Numbers (GTINs) that identify products to search for. Currently the GTIN values can include EAN, ISBN, and UPC identifier types. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value.  <br /><br /> You cannot use the <b>gtin</b> parameter in the same method with either the <b>q</b> parameter or the <b>aspect_filter</b> parameter. </span>
        :param str limit: The number of product summaries to return. This is the <i>result set</i>, a subset of the full collection of products that match the search or filter criteria of this call. <br /><br /> <b>Maximum:</b> <code>200</code> <br /> <b>Default:</b> <code>50</code>
        :param str mpn: A string consisting of one or more comma-separated Manufacturer Part Numbers (MPNs) that identify products to search for. This method will return all products that have one of the specified MPNs. <br /><br /> MPNs are defined by manufacturers for their own products, and are therefore certain to be unique only within a given brand. However, many MPNs do turn out to be globally unique. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. <br /><br /> You cannot use the <b>mpn</b> parameter in the same method with either the <b>q</b> parameter or the <b>aspect_filter</b> parameter. </span>
        :param str offset: This parameter is reserved for internal or future use.
        :param str q: A string consisting of one or more keywords to use to search for products in the eBay catalog. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> This method searches the following product record fields: <b>title</b>, <b>description</b>, <b>brand</b>, and <b>aspects.localizedName</b>, which do not include product IDs. Wildcard characters (e.g. <code>*</code>) are not allowed. </span> <br /><br /> The keywords are handled as follows: <ul> <li>If the keywords are separated by a comma (e.g. <code>iPhone,256GB</code>), the query returns products that have <code>iPhone</code> <b>AND</b> <code>256GB</code>.</li> <li>If the keywords are separated by a space (e.g. <code>\"iPhone&nbsp;ipad\"</code> or <code>\"iPhone,&nbsp;ipad\"</code>), the query ignores any commas and returns products that have <code>iPhone</code> <b>OR</b> <code>iPad</code>.</li> </ul> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value.  <br /><br /> You cannot use the <b>q</b> parameter in the same method with either the <b>gtin</b> parameter or the <b>mpn</b> parameter. </span>
        :return: ProductSearchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.search_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.search_with_http_info(**kwargs)  # noqa: E501
            return data

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

        This method searches for and retrieves summaries of one or more products in the eBay catalog that match the search criteria provided by a seller. The seller can use the summaries to select the product in the eBay catalog that corresponds to the item that the seller wants to offer for sale. When a corresponding product is found and adopted by the seller, eBay will use the product information to populate the item listing. The criteria supported by <b>search</b> include keywords, product categories, and category aspects. To see the full details of a selected product, use the <b>getProduct</b> call. <br /><br /> In addition to product summaries, this method can also be used to identify <i>refinements</i>, which help you to better pinpoint the product you're looking for. A refinement consists of one or more <i>aspect</i> values and a count of the number of times that each value has been used in previous eBay listings. An aspect is a property (e.g. color or size) of an eBay category, used by sellers to provide details about the items they're listing. The <b>refinement</b> container is returned when you include the <b>fieldGroups</b> query parameter in the request with a value of <code>ASPECT_REFINEMENTS</code> or <code>FULL</code>. <br /><br /> <span style=\"padding: 15px 20px; display: block; border: 1px solid #cccccc\"><b>Example</b> <br />A seller wants to find a product that is \"gray\" in color, but doesn't know what term the manufacturer uses for that color. It might be <code>Silver</code>, <code>Brushed Nickel</code>, <code>Pewter</code>, or even <code>Grey</code>. The returned <b>refinement</b> container identifies all aspects that have been used in past listings for products that match your search criteria, along with all of the values those aspects have taken, and the number of times each value was used. You can use this data to present the seller with a histogram of the values of each aspect. The seller can see which color values have been used in the past, and how frequently they have been used, and selects the most likely value or values for their product. You issue the <b>search</b> method again with those values in the <b>aspect_filter</b> parameter to narrow down the collection of products returned by the call.</span> <br /><br /> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. If you provide more than one of these parameters, they will be combined with a logical AND to further refine the returned collection of matching products. <br /><br /> <span class=\"tablenote\"><strong>Note:</strong> This method requires that certain special characters in the query parameters be percent-encoded: <br /><br /> &nbsp;&nbsp;&nbsp;&nbsp;<code>(space)</code> = <code>%20</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>,</code> = <code>%2C</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>:</code> = <code>%3A</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>[</code> = <code>%5B</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>]</code> = <code>%5D</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>{</code> = <code>%7B</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>|</code> = <code>%7C</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code> = <code>%7D</code> <br /><br /> This requirement applies to all query parameter values. However, for readability, method examples and samples in this documentation will not use the encoding.</span> <br /><br /> This method returns product summaries rather than the full details of the products. To retrieve the full details of a product, use the <b>getProduct</b> method with an ePID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str x_ebay_c_marketplace_id: This method also uses the <code>X-EBAY-C-MARKETPLACE-ID</code> header to identify the seller's eBay marketplace. It is required for all marketplaces except EBAY_US, which is the default. <b>Note:</b> This method is limited to <code>EBAY_US</code>, <code>EBAY_AU</code>, <code>EBAY_CA</code>, and <code>EBAY_GB</code> values.
        :param str aspect_filter: An eBay category and one or more aspects of that category, with the values that can be used to narrow down the collection of products returned by this call. <br /><br /> Aspects are product attributes that can represent different types of information for different products. Every product has aspects, but different products have different sets of aspects. <br /><br /> You can determine appropriate values for the aspects by first submitting this method without this parameter. It will return either the <b>productSummaries.aspects</b> container, the <b>refinement.aspectDistributions</b> container, or both, depending on the value of the <b>fieldgroups</b> parameter in the request. The <b>productSummaries.aspects</b> container provides the category aspects and their values that are associated with each returned product. The <b>refinement.aspectDistributions</b> container provides information about the distribution of values of the set of category aspects associated with the specified categories. In both cases sellers can select from among the returned aspects to use with this parameter. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> You can also use the Taxonomy API's <b>getItemAspectsForCategory</b> method to retrieve detailed information about aspects and their values that are appropriate for your selected category. </span> <br /><br /> The syntax for the <b>aspect_filter</b> parameter is as follows (on several lines for readability; <b>categoryId</b> is required): <br /><br /> <code>aspect_filter=categoryId:<i>category_id</i>,<br /> <i>aspect1</i>:{<i>valueA</i>|<i>valueB</i>|...},<br /> <i>aspect2</i>:{<i>valueC</i>|<i>valueD</i>|...},.</code> <br /><br /> A matching product must be within the specified category, and it must have least one of the values identified for every specified aspect. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Aspect names and values are case sensitive. </span> <br /><br /> Here is an example of an <b>aspect_filter</b> parameter in which <code>9355</code> is the category ID, <code>Color</code> is an aspect of that category, and <code>Black</code> and <code>White</code> are possible values of that aspect (on several lines for readability): <br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> aspect_filter=categoryId:9355,Color:{White|Black}</code>    <br /><br /> Here is the <b>aspect_filter</b> with required URL encoding and a second aspect (on several lines for readability): <br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> aspect_filter=categoryId:9355,Color:%7BWhite%7CBlack%7D,<br /> Storage%20Capacity:%128GB%7C256GB%7D</code> <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> You cannot use the <b>aspect_filter</b> parameter in the same method with either the <b>gtin</b> parameter or the <b>mpn</b> parameter. </span> For implementation help, refer to eBay API documentation at https://developer.ebay.com/api-docs/commerce/catalog/types/catal:AspectFilter
        :param str category_ids: <span class=\"tablenote\"> <strong>Important:</strong> Currently, only the first <b>category_id</b> value is accepted. </span> <br /><br /> One or more comma-separated category identifiers for narrowing down the collection of products returned by this call. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> This parameter requires a valid category ID value. You can use the Taxonomy API's <b>getCategorySuggestions</b> method to retrieve appropriate category IDs for your product based on keywords. </span> <br /><br /> The syntax for this parameter is as follows: <br /><br /> <code>category_ids=<i>category_id1</i>,<i>category_id2</i>,.</code> <br /><br /> Here is an example of a method with the <b>category_ids</b> parameter: br /><br /> <code>GET https://api.ebay.com/commerce/catalog/v1_beta/product_summary/search?<br /> category_ids=178893</code> <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. <br /><br /> If you provide only the <b>category_ids</b> parameter, you cannot specify a top-level (L1) category. </span>
        :param str fieldgroups: The type of information to return in the response. <br /><br /> <span class=\"tablenote\"> <strong>Important:</strong> This parameter may not produce valid results if you also provide more than one value for the <b>category_ids</b> parameter. It is recommended that you avoid using this combination. </span> <br /><br /> <b> Valid Values: </b> <ul> <li><code>ASPECT_REFINEMENTS</code> &mdash; This returns the <b>refinement</b> container, which includes the category aspect and aspect value distributions that apply to the returned products. For example, if you searched for <code>Ford Mustang</code>, some of the category aspects might be <b>Model Year</b>, <b>Exterior Color</b>, <b>Vehicle Mileage</b>, and so on. <br /> <br /> <span class=\"tablenote\"> <b>Note: </b>Aspects are category specific.</span> </li> <li><code>FULL</code> &mdash; This returns all the refinement containers and all the matching products. This value overrides the other values, which will be ignored.</li> <li><code>MATCHING_PRODUCTS</code> &mdash; This returns summaries for all products that match the values you provide for the <b>q</b> and <b>category_ids</b> parameters. This does not affect your use of the <code>ASPECT_REFINEMENTS</code> value, which you can use in the same call.</li> </ul> Code so that your app gracefully handles any future changes to this list. <br /><br /><b>Default: </b> <code>MATCHING_PRODUCTS</code>
        :param str gtin: A string consisting of one or more comma-separated Global Trade Item Numbers (GTINs) that identify products to search for. Currently the GTIN values can include EAN, ISBN, and UPC identifier types. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value.  <br /><br /> You cannot use the <b>gtin</b> parameter in the same method with either the <b>q</b> parameter or the <b>aspect_filter</b> parameter. </span>
        :param str limit: The number of product summaries to return. This is the <i>result set</i>, a subset of the full collection of products that match the search or filter criteria of this call. <br /><br /> <b>Maximum:</b> <code>200</code> <br /> <b>Default:</b> <code>50</code>
        :param str mpn: A string consisting of one or more comma-separated Manufacturer Part Numbers (MPNs) that identify products to search for. This method will return all products that have one of the specified MPNs. <br /><br /> MPNs are defined by manufacturers for their own products, and are therefore certain to be unique only within a given brand. However, many MPNs do turn out to be globally unique. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value. <br /><br /> You cannot use the <b>mpn</b> parameter in the same method with either the <b>q</b> parameter or the <b>aspect_filter</b> parameter. </span>
        :param str offset: This parameter is reserved for internal or future use.
        :param str q: A string consisting of one or more keywords to use to search for products in the eBay catalog. <br /><br /> <span class=\"tablenote\"> <strong>Note:</strong> This method searches the following product record fields: <b>title</b>, <b>description</b>, <b>brand</b>, and <b>aspects.localizedName</b>, which do not include product IDs. Wildcard characters (e.g. <code>*</code>) are not allowed. </span> <br /><br /> The keywords are handled as follows: <ul> <li>If the keywords are separated by a comma (e.g. <code>iPhone,256GB</code>), the query returns products that have <code>iPhone</code> <b>AND</b> <code>256GB</code>.</li> <li>If the keywords are separated by a space (e.g. <code>\"iPhone&nbsp;ipad\"</code> or <code>\"iPhone,&nbsp;ipad\"</code>), the query ignores any commas and returns products that have <code>iPhone</code> <b>OR</b> <code>iPad</code>.</li> </ul> <span class=\"tablenote\"> <strong>Note:</strong> Although all query parameters are optional, this method must include at least the <b>q</b> parameter, or the <b>category_ids</b>, <b>gtin</b>, or <b>mpn</b> parameter with a valid value.  <br /><br /> You cannot use the <b>q</b> parameter in the same method with either the <b>gtin</b> parameter or the <b>mpn</b> parameter. </span>
        :return: ProductSearchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_ebay_c_marketplace_id', 'aspect_filter', 'category_ids', 'fieldgroups', 'gtin', 'limit', 'mpn', 'offset', 'q']  # 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 search" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'aspect_filter' in params:
            query_params.append(('aspect_filter', params['aspect_filter']))  # noqa: E501
        if 'category_ids' in params:
            query_params.append(('category_ids', params['category_ids']))  # noqa: E501
        if 'fieldgroups' in params:
            query_params.append(('fieldgroups', params['fieldgroups']))  # noqa: E501
        if 'gtin' in params:
            query_params.append(('gtin', params['gtin']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501
        if 'mpn' in params:
            query_params.append(('mpn', params['mpn']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'q' in params:
            query_params.append(('q', params['q']))  # noqa: E501

        header_params = {}
        if 'x_ebay_c_marketplace_id' in params:
            header_params['X-EBAY-C-MARKETPLACE-ID'] = params['x_ebay_c_marketplace_id']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['api_auth']  # noqa: E501

        return self.api_client.call_api(
            '/product_summary/search', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ProductSearchResponse',  # 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)
