# coding: utf-8

"""
    The Selling Partner API for Automotive.

    The Selling Partner API for Automotive provides programmatic access to information needed by selling partners to provide compatibility information about their listed products.

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

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


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from spapi.api_client import ApiClient


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

    Do not edit the class manually.
    """

    api_models_module = "spapi.models.vehicles_v2024_11_01"

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

    def get_vehicles(self, marketplace_id, vehicle_type, **kwargs):  # noqa: E501
        """get_vehicles  # noqa: E501

        Get the latest collection of vehicles  # 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_vehicles(marketplace_id, vehicle_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str marketplace_id: An identifier for the marketplace in which the resource operates. (required)
        :param str vehicle_type: An identifier for vehicle type. (required)
        :param str page_token: A token to fetch a certain page when there are multiple pages worth of results.
        :param str updated_after: Date in ISO 8601 format, if provided only vehicles which are modified/added to Amazon's catalog after this date will be returned.
        :return: VehiclesResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_vehicles_with_http_info(marketplace_id, vehicle_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_vehicles_with_http_info(marketplace_id, vehicle_type, **kwargs)  # noqa: E501
            return data

    def get_vehicles_with_http_info(self, marketplace_id, vehicle_type, **kwargs):  # noqa: E501
        """get_vehicles  # noqa: E501

        Get the latest collection of vehicles  # 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_vehicles_with_http_info(marketplace_id, vehicle_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str marketplace_id: An identifier for the marketplace in which the resource operates. (required)
        :param str vehicle_type: An identifier for vehicle type. (required)
        :param str page_token: A token to fetch a certain page when there are multiple pages worth of results.
        :param str updated_after: Date in ISO 8601 format, if provided only vehicles which are modified/added to Amazon's catalog after this date will be returned.
        :return: VehiclesResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page_token' in params:
            query_params.append(('pageToken', params['page_token']))  # noqa: E501
        if 'marketplace_id' in params:
            query_params.append(('marketplaceId', params['marketplace_id']))  # noqa: E501
        if 'vehicle_type' in params:
            query_params.append(('vehicleType', params['vehicle_type']))  # noqa: E501
        if 'updated_after' in params:
            query_params.append(('updatedAfter', params['updated_after']))  # 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(
            '/catalog/2024-11-01/automotive/vehicles', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='VehiclesResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)
