# coding: utf-8

"""
    Marketcheck Cars API

    <b>Access the New, Used and Certified cars inventories for all Car Dealers in US.</b> <br/>The data is sourced from online listings by over 44,000 Car dealers in US. At any time, there are about 6.2M searchable listings (about 1.9M unique VINs) for Used & Certified cars and about 6.6M (about 3.9M unique VINs) New Car listings from all over US. We use this API at the back for our website <a href='https://www.marketcheck.com' target='_blank'>www.marketcheck.com</a> and our Android and iOS mobile apps too.<br/><h5> Few useful links : </h5><ul><li>A quick view of the API and the use cases is depicated <a href='https://portals.marketcheck.com/mcapi/' target='_blank'>here</a></li><li>The Postman collection with various usages of the API is shared here https://www.getpostman.com/collections/2752684ff636cdd7bac2</li></ul>  # noqa: E501

    OpenAPI spec version: 1.0.3
    
    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 marketcheck_api_sdk.api_client import ApiClient


class MarketApi(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 get_averages(self, vin, **kwargs):  # noqa: E501
        """[MOCK] Get Averages for YMM  # noqa: E501

        [Merged with the /search API - Please check the 'stats' parameter to the Search API above] Get market averages for price / miles / msrp / dom (days on market) fields for active cars matching the given reference VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_averages(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which averages data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str year: Year of the car
        :param str make: Make of the car
        :param str model: Model of the Car
        :param str trim: Trim of the Car
        :param str fields: Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)
        :return: Averages
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_averages_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_averages_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_averages_with_http_info(self, vin, **kwargs):  # noqa: E501
        """[MOCK] Get Averages for YMM  # noqa: E501

        [Merged with the /search API - Please check the 'stats' parameter to the Search API above] Get market averages for price / miles / msrp / dom (days on market) fields for active cars matching the given reference VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_averages_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which averages data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str year: Year of the car
        :param str make: Make of the car
        :param str model: Model of the Car
        :param str trim: Trim of the Car
        :param str fields: Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)
        :return: Averages
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'api_key', 'year', 'make', 'model', 'trim', 'fields']  # noqa: E501
        all_params.append('async')
        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_averages" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_averages`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # noqa: E501
        if 'year' in params:
            query_params.append(('year', params['year']))  # noqa: E501
        if 'make' in params:
            query_params.append(('make', params['make']))  # noqa: E501
        if 'model' in params:
            query_params.append(('model', params['model']))  # noqa: E501
        if 'trim' in params:
            query_params.append(('trim', params['trim']))  # noqa: E501
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/averages', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Averages',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_comparison(self, vin, **kwargs):  # noqa: E501
        """Compare market  # noqa: E501

        [MOCK] Get historical market trends for cars matching the given VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_comparison(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which comparison data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: ComparisonPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_comparison_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_comparison_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_comparison_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Compare market  # noqa: E501

        [MOCK] Get historical market trends for cars matching the given VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_comparison_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which comparison data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: ComparisonPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'api_key']  # noqa: E501
        all_params.append('async')
        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_comparison" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_comparison`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/comparison', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ComparisonPoint',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_competition(self, vin, **kwargs):  # noqa: E501
        """Competitors  # noqa: E501

        [MOCK] Competitor cars in market for current vin  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_competition(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which competitors data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: CompetitorsPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_competition_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_competition_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_competition_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Competitors  # noqa: E501

        [MOCK] Competitor cars in market for current vin  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_competition_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which competitors data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: CompetitorsPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'api_key']  # noqa: E501
        all_params.append('async')
        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_competition" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_competition`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/competition', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CompetitorsPoint',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_depreciation(self, vin, **kwargs):  # noqa: E501
        """Depreciation  # noqa: E501

        [MOCK] Model resale value based on depreciation  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_depreciation(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which Depreciation stats is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: DepreciationPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_depreciation_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_depreciation_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_depreciation_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Depreciation  # noqa: E501

        [MOCK] Model resale value based on depreciation  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_depreciation_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which Depreciation stats is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: DepreciationPoint
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'api_key']  # noqa: E501
        all_params.append('async')
        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_depreciation" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_depreciation`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/depreciation', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DepreciationPoint',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_mds(self, vin, **kwargs):  # noqa: E501
        """Market Days Supply  # noqa: E501

        Get the basic information on specifications for a car identified by a valid VIN  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_mds(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to decode (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param bool exact: Exact parameter
        :param float latitude: Latitude component of location
        :param float longitude: Longitude component of location
        :param int radius: Radius around the search location
        :param int debug: Debug parameter
        :param bool include_sold: To fetch sold vins
        :return: Mds
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_mds_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_mds_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_mds_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Market Days Supply  # noqa: E501

        Get the basic information on specifications for a car identified by a valid VIN  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_mds_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to decode (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param bool exact: Exact parameter
        :param float latitude: Latitude component of location
        :param float longitude: Longitude component of location
        :param int radius: Radius around the search location
        :param int debug: Debug parameter
        :param bool include_sold: To fetch sold vins
        :return: Mds
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'api_key', 'exact', 'latitude', 'longitude', 'radius', 'debug', 'include_sold']  # noqa: E501
        all_params.append('async')
        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_mds" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_mds`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # noqa: E501
        if 'exact' in params:
            query_params.append(('exact', params['exact']))  # noqa: E501
        if 'latitude' in params:
            query_params.append(('latitude', params['latitude']))  # noqa: E501
        if 'longitude' in params:
            query_params.append(('longitude', params['longitude']))  # noqa: E501
        if 'radius' in params:
            query_params.append(('radius', params['radius']))  # noqa: E501
        if 'debug' in params:
            query_params.append(('debug', params['debug']))  # noqa: E501
        if 'include_sold' in params:
            query_params.append(('include_sold', params['include_sold']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/mds', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Mds',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_popularity(self, year, make, model, trim, body_type, **kwargs):  # noqa: E501
        """Popularity  # noqa: E501

        [MOCK] [Merged with the /search API - Please check the 'popularity' parameter to the Search API above] Get the Popularity for the given simple filter criteria (by given Year, Make, Model, Trim criteria)  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_popularity(year, make, model, trim, body_type, async=True)
        >>> result = thread.get()

        :param async bool
        :param str year: Year of the car (required)
        :param str make: Make of the car (required)
        :param str model: Model of the Car (required)
        :param str trim: Trim of the Car (required)
        :param str body_type: Body type to filter the cars on. Valid values are the ones returned by body_type facets API call (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str stats: The list of fields for which stats need to be generated based on the matching listings for the search criteria. Allowed fields are - price, miles, msrp, dom The stats consists of mean, max, average and count of listings based on which the stats are calculated for the field. Stats could be requested in addition to the listings for the search. Please note - The API calls with the stats fields may take longer to respond.
        :return: list[PopularityItem]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_popularity_with_http_info(year, make, model, trim, body_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_popularity_with_http_info(year, make, model, trim, body_type, **kwargs)  # noqa: E501
            return data

    def get_popularity_with_http_info(self, year, make, model, trim, body_type, **kwargs):  # noqa: E501
        """Popularity  # noqa: E501

        [MOCK] [Merged with the /search API - Please check the 'popularity' parameter to the Search API above] Get the Popularity for the given simple filter criteria (by given Year, Make, Model, Trim criteria)  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_popularity_with_http_info(year, make, model, trim, body_type, async=True)
        >>> result = thread.get()

        :param async bool
        :param str year: Year of the car (required)
        :param str make: Make of the car (required)
        :param str model: Model of the Car (required)
        :param str trim: Trim of the Car (required)
        :param str body_type: Body type to filter the cars on. Valid values are the ones returned by body_type facets API call (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str stats: The list of fields for which stats need to be generated based on the matching listings for the search criteria. Allowed fields are - price, miles, msrp, dom The stats consists of mean, max, average and count of listings based on which the stats are calculated for the field. Stats could be requested in addition to the listings for the search. Please note - The API calls with the stats fields may take longer to respond.
        :return: list[PopularityItem]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['year', 'make', 'model', 'trim', 'body_type', 'api_key', 'stats']  # noqa: E501
        all_params.append('async')
        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_popularity" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'year' is set
        if ('year' not in params or
                params['year'] is None):
            raise ValueError("Missing the required parameter `year` when calling `get_popularity`")  # noqa: E501
        # verify the required parameter 'make' is set
        if ('make' not in params or
                params['make'] is None):
            raise ValueError("Missing the required parameter `make` when calling `get_popularity`")  # noqa: E501
        # verify the required parameter 'model' is set
        if ('model' not in params or
                params['model'] is None):
            raise ValueError("Missing the required parameter `model` when calling `get_popularity`")  # noqa: E501
        # verify the required parameter 'trim' is set
        if ('trim' not in params or
                params['trim'] is None):
            raise ValueError("Missing the required parameter `trim` when calling `get_popularity`")  # noqa: E501
        # verify the required parameter 'body_type' is set
        if ('body_type' not in params or
                params['body_type'] is None):
            raise ValueError("Missing the required parameter `body_type` when calling `get_popularity`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'year' in params:
            query_params.append(('year', params['year']))  # noqa: E501
        if 'make' in params:
            query_params.append(('make', params['make']))  # noqa: E501
        if 'model' in params:
            query_params.append(('model', params['model']))  # noqa: E501
        if 'trim' in params:
            query_params.append(('trim', params['trim']))  # noqa: E501
        if 'body_type' in params:
            query_params.append(('body_type', params['body_type']))  # noqa: E501
        if 'stats' in params:
            query_params.append(('stats', params['stats']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/popularity', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[PopularityItem]',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_sales_count(self, **kwargs):  # noqa: E501
        """Get sales count by make, model, year, trim or taxonomy vin  # noqa: E501

        Get a sales count for city, state or national level by make, model, year, trim or taxonomy vin  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_sales_count(async=True)
        >>> result = thread.get()

        :param async bool
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str car_type: Inventory type for which sales count is to be searched, default is used
        :param str make: Make for which sales count is to be searched
        :param str mm: Make-Model for which sales count is to be searched, pipe seperated like mm=ford|f-150
        :param str ymm: Year-Make-Model for which sales count is to be searched, pipe seperated like ymm=2015|ford|f-150
        :param str ymmt: Year-Make-Model-Trim for which sales count is to be searched, pipe seperated like ymmt=2015|ford|f-150|platinum
        :param str taxonomy_vin: taxonomy_vin for which sales count is to be searched
        :param str state: State level sales count
        :param str city_state: City level sales count, pipe seperated like city_state=jacksonville|FL
        :param str stats: Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, dom (days on market) OR all
        :return: Sales
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_sales_count_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_sales_count_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_sales_count_with_http_info(self, **kwargs):  # noqa: E501
        """Get sales count by make, model, year, trim or taxonomy vin  # noqa: E501

        Get a sales count for city, state or national level by make, model, year, trim or taxonomy vin  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_sales_count_with_http_info(async=True)
        >>> result = thread.get()

        :param async bool
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str car_type: Inventory type for which sales count is to be searched, default is used
        :param str make: Make for which sales count is to be searched
        :param str mm: Make-Model for which sales count is to be searched, pipe seperated like mm=ford|f-150
        :param str ymm: Year-Make-Model for which sales count is to be searched, pipe seperated like ymm=2015|ford|f-150
        :param str ymmt: Year-Make-Model-Trim for which sales count is to be searched, pipe seperated like ymmt=2015|ford|f-150|platinum
        :param str taxonomy_vin: taxonomy_vin for which sales count is to be searched
        :param str state: State level sales count
        :param str city_state: City level sales count, pipe seperated like city_state=jacksonville|FL
        :param str stats: Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, dom (days on market) OR all
        :return: Sales
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['api_key', 'car_type', 'make', 'mm', 'ymm', 'ymmt', 'taxonomy_vin', 'state', 'city_state', 'stats']  # noqa: E501
        all_params.append('async')
        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_sales_count" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'car_type' in params:
            query_params.append(('car_type', params['car_type']))  # noqa: E501
        if 'make' in params:
            query_params.append(('make', params['make']))  # noqa: E501
        if 'mm' in params:
            query_params.append(('mm', params['mm']))  # noqa: E501
        if 'ymm' in params:
            query_params.append(('ymm', params['ymm']))  # noqa: E501
        if 'ymmt' in params:
            query_params.append(('ymmt', params['ymmt']))  # noqa: E501
        if 'taxonomy_vin' in params:
            query_params.append(('taxonomy_vin', params['taxonomy_vin']))  # noqa: E501
        if 'state' in params:
            query_params.append(('state', params['state']))  # noqa: E501
        if 'city_state' in params:
            query_params.append(('city_state', params['city_state']))  # noqa: E501
        if 'stats' in params:
            query_params.append(('stats', params['stats']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/sales', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Sales',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_trends(self, vin, car_type, **kwargs):  # noqa: E501
        """Get Trends for criteria  # noqa: E501

        Get historical market trends for cars matching the given VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_trends(vin, car_type, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which trend data is to be returned (required)
        :param str car_type: Car type. Allowed values are - new / used / certified (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str year: Year of the car
        :param str make: Make of the car
        :param str model: Model of the Car
        :param str trim: Trim of the Car
        :return: list[TrendPoint]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_trends_with_http_info(vin, car_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_trends_with_http_info(vin, car_type, **kwargs)  # noqa: E501
            return data

    def get_trends_with_http_info(self, vin, car_type, **kwargs):  # noqa: E501
        """Get Trends for criteria  # noqa: E501

        Get historical market trends for cars matching the given VIN's basic specification or Year, Make, Model, Trim (Optional) criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_trends_with_http_info(vin, car_type, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which trend data is to be returned (required)
        :param str car_type: Car type. Allowed values are - new / used / certified (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :param str year: Year of the car
        :param str make: Make of the car
        :param str model: Model of the Car
        :param str trim: Trim of the Car
        :return: list[TrendPoint]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['vin', 'car_type', 'api_key', 'year', 'make', 'model', 'trim']  # noqa: E501
        all_params.append('async')
        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_trends" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'vin' is set
        if ('vin' not in params or
                params['vin'] is None):
            raise ValueError("Missing the required parameter `vin` when calling `get_trends`")  # noqa: E501
        # verify the required parameter 'car_type' is set
        if ('car_type' not in params or
                params['car_type'] is None):
            raise ValueError("Missing the required parameter `car_type` when calling `get_trends`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # noqa: E501
        if 'car_type' in params:
            query_params.append(('car_type', params['car_type']))  # noqa: E501
        if 'year' in params:
            query_params.append(('year', params['year']))  # noqa: E501
        if 'make' in params:
            query_params.append(('make', params['make']))  # noqa: E501
        if 'model' in params:
            query_params.append(('model', params['model']))  # noqa: E501
        if 'trim' in params:
            query_params.append(('trim', params['trim']))  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/trends', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[TrendPoint]',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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)
