# coding: utf-8

"""
    Classified Leads API

    The <b>Leads API</b> lets sellers return leads generated by their classified ad listings and includes any contact information that prospective buyers have submitted. A seller can retrieve leads for listed items for a specified marketplace optionally filtered by specified search criteria. Use this resource to retrieve sales-lead information for classified ad listings. For additional information on classified adds, see <a href=\"https://www.ebay.com/help/selling/listings/listing-tips/selling-classified-ads?id=4167\" target=\"_blank\">Selling with Classified Ads</a>.<p>The <b>getClassifiedLeadsByItemId</b> method retrieves leads for a specific classified ad listing, while <b>getAllClassifiedLeads</b> method retrieves leads for all active classified ad listings.</p><p><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units. For information on how to obtain access to this API in production, please contact eBay support.</span></p>  # noqa: E501

    OpenAPI spec version: v1.0.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 ...sell_leads.api_client import ApiClient


class ClassifiedLeadApi(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_all_classified_leads(self, content_type, **kwargs):  # noqa: E501
        """get_all_classified_leads  # noqa: E501

        This method retrieves leads for all of the seller's active classified ad listings. Optionally, just those matching specified filter criteria can be returned.<p><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units. For information on how to obtain access to this API in production, please contact eBay support.</span></p>  # 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_all_classified_leads(content_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str content_type: This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. (required)
        :param str end_time: Use with <b>startTime</b> to limit the returned leads for the user. Only leads with a creation date less than or equal to the specified date and time will be returned.<p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str include_messages: Boolean that indicates whether to return mail messages for this lead in a <b>memberMessage</b> container (<code>true</code> returns messages). If omitted, no messages for this lead will be returned (same as when set to <code>false</code>).<p><b>Default: </b>false<p>
        :param str start_time: Use with <b>endTime</b> to limit the returned leads for the user. Only leads for active listings with a creation date greater than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str status: The enumeration value in this field will indicate whether or not a question has been answered. Valid values include: <br><ul><li><code>Answered</code></li> <li><code>Unanswered</code></li></ul>
        :param str accept_encoding: This header indicates the compression-encoding algorithms the client accepts for the response. This value should be set to <code>gzip</code>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
        :return: ClassifiedLeadsListResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_all_classified_leads_with_http_info(content_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_all_classified_leads_with_http_info(content_type, **kwargs)  # noqa: E501
            return data

    def get_all_classified_leads_with_http_info(self, content_type, **kwargs):  # noqa: E501
        """get_all_classified_leads  # noqa: E501

        This method retrieves leads for all of the seller's active classified ad listings. Optionally, just those matching specified filter criteria can be returned.<p><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units. For information on how to obtain access to this API in production, please contact eBay support.</span></p>  # 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_all_classified_leads_with_http_info(content_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str content_type: This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. (required)
        :param str end_time: Use with <b>startTime</b> to limit the returned leads for the user. Only leads with a creation date less than or equal to the specified date and time will be returned.<p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str include_messages: Boolean that indicates whether to return mail messages for this lead in a <b>memberMessage</b> container (<code>true</code> returns messages). If omitted, no messages for this lead will be returned (same as when set to <code>false</code>).<p><b>Default: </b>false<p>
        :param str start_time: Use with <b>endTime</b> to limit the returned leads for the user. Only leads for active listings with a creation date greater than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str status: The enumeration value in this field will indicate whether or not a question has been answered. Valid values include: <br><ul><li><code>Answered</code></li> <li><code>Unanswered</code></li></ul>
        :param str accept_encoding: This header indicates the compression-encoding algorithms the client accepts for the response. This value should be set to <code>gzip</code>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
        :return: ClassifiedLeadsListResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['content_type', 'end_time', 'include_messages', 'start_time', 'status', 'accept_encoding']  # 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_all_classified_leads" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'content_type' is set
        if ('content_type' not in params or
                params['content_type'] is None):
            raise ValueError("Missing the required parameter `content_type` when calling `get_all_classified_leads`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'end_time' in params:
            query_params.append(('endTime', params['end_time']))  # noqa: E501
        if 'include_messages' in params:
            query_params.append(('includeMessages', params['include_messages']))  # noqa: E501
        if 'start_time' in params:
            query_params.append(('startTime', params['start_time']))  # noqa: E501
        if 'status' in params:
            query_params.append(('status', params['status']))  # noqa: E501

        header_params = {}
        if 'content_type' in params:
            header_params['Content-Type'] = params['content_type']  # noqa: E501
        if 'accept_encoding' in params:
            header_params['Accept-Encoding'] = params['accept_encoding']  # 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(
            '/classified_lead', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ClassifiedLeadsListResponse',  # 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_classified_leads_by_item_id(self, item_id, content_type, **kwargs):  # noqa: E501
        """get_classified_leads_by_item_id  # noqa: E501

        This method returns a seller account's leads generated by the specified classified ad, and includes any contact information that prospective buyers have submitted. Optionally, just those matching specified filter criteria can be returned.<p><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units. For information on how to obtain access to this API in production, please contact eBay support.</span></p>  # 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_classified_leads_by_item_id(item_id, content_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str item_id: The unique identifier of the listing. (required)
        :param str content_type: This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. (required)
        :param str end_time: Use with <b>startTime</b> to limit the returned leads for the user for active listings. Only leads with a creation date less than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock. <br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str include_messages: Include this field and set it to true to retrieve any member messages associated with leads in the <b>memberMessage</b> container (<code>true</code> returns messages).<br><br><b>Default</b>: <code>true</code>
        :param str start_time: Use with <b>endTime</b> to limit the returned leads for the user. Only leads with a start time greater than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str status: Include this field if you would only like to retrieve leads where the buyer has answered questions or has not answered questions. If not used, leads with answered questions and unanswered questions are returned. Valid values include: <br><ul><li><code>Answered</code></li> <li><code>Unanswered</code></li></ul>
        :param str accept_encoding: This header indicates the compression-encoding algorithms the client accepts for the response. This value should be set to <code>gzip</code>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
        :return: ClassifiedLead
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_classified_leads_by_item_id_with_http_info(item_id, content_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_classified_leads_by_item_id_with_http_info(item_id, content_type, **kwargs)  # noqa: E501
            return data

    def get_classified_leads_by_item_id_with_http_info(self, item_id, content_type, **kwargs):  # noqa: E501
        """get_classified_leads_by_item_id  # noqa: E501

        This method returns a seller account's leads generated by the specified classified ad, and includes any contact information that prospective buyers have submitted. Optionally, just those matching specified filter criteria can be returned.<p><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units. For information on how to obtain access to this API in production, please contact eBay support.</span></p>  # 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_classified_leads_by_item_id_with_http_info(item_id, content_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str item_id: The unique identifier of the listing. (required)
        :param str content_type: This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. (required)
        :param str end_time: Use with <b>startTime</b> to limit the returned leads for the user for active listings. Only leads with a creation date less than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock. <br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str include_messages: Include this field and set it to true to retrieve any member messages associated with leads in the <b>memberMessage</b> container (<code>true</code> returns messages).<br><br><b>Default</b>: <code>true</code>
        :param str start_time: Use with <b>endTime</b> to limit the returned leads for the user. Only leads with a start time greater than or equal to the specified date and time will be returned. <p><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note: </strong>The <b>startTime</b> and <b>endTime</b> fields can be used independently to filter results.</span></p>The time stamp must be formatted as an <a href=\"https://www.iso.org/iso-8601-date-and-time-format.html\" target=\"_blank\">ISO 8601</a> string, which is based on the 24-hour Universal Coordinated Time (UTC) clock.<br><br><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[SS]Z</code> <br><b>Example:</b>  <code>2025-01-10T15:54:00Z</code>
        :param str status: Include this field if you would only like to retrieve leads where the buyer has answered questions or has not answered questions. If not used, leads with answered questions and unanswered questions are returned. Valid values include: <br><ul><li><code>Answered</code></li> <li><code>Unanswered</code></li></ul>
        :param str accept_encoding: This header indicates the compression-encoding algorithms the client accepts for the response. This value should be set to <code>gzip</code>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>.
        :return: ClassifiedLead
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['item_id', 'content_type', 'end_time', 'include_messages', 'start_time', 'status', 'accept_encoding']  # 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_classified_leads_by_item_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'item_id' is set
        if ('item_id' not in params or
                params['item_id'] is None):
            raise ValueError("Missing the required parameter `item_id` when calling `get_classified_leads_by_item_id`")  # noqa: E501
        # verify the required parameter 'content_type' is set
        if ('content_type' not in params or
                params['content_type'] is None):
            raise ValueError("Missing the required parameter `content_type` when calling `get_classified_leads_by_item_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'item_id' in params:
            path_params['itemId'] = params['item_id']  # noqa: E501

        query_params = []
        if 'end_time' in params:
            query_params.append(('endTime', params['end_time']))  # noqa: E501
        if 'include_messages' in params:
            query_params.append(('includeMessages', params['include_messages']))  # noqa: E501
        if 'start_time' in params:
            query_params.append(('startTime', params['start_time']))  # noqa: E501
        if 'status' in params:
            query_params.append(('status', params['status']))  # noqa: E501

        header_params = {}
        if 'content_type' in params:
            header_params['Content-Type'] = params['content_type']  # noqa: E501
        if 'accept_encoding' in params:
            header_params['Accept-Encoding'] = params['accept_encoding']  # 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(
            '/classified_lead/{itemId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ClassifiedLead',  # 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)
