# coding: utf-8

"""
    Fingerprint Server API

    Fingerprint Server API allows you to search, update, and delete identification events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.   # noqa: E501

    OpenAPI spec version: 3
    Contact: support@fingerprint.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

import re  # noqa: F401
from multiprocessing import Pool
from multiprocessing.pool import ApplyResult as AsyncResult
from typing import Optional, Union

from fingerprint_pro_server_api_sdk.configuration import Configuration
from fingerprint_pro_server_api_sdk.api_client import ApiClient
from fingerprint_pro_server_api_sdk.extend_exception import extend_exception
from fingerprint_pro_server_api_sdk.rest import ApiException
from fingerprint_pro_server_api_sdk.models.error_plain_response import ErrorPlainResponse  # noqa: F401
from fingerprint_pro_server_api_sdk.models.error_response import ErrorResponse  # noqa: F401
from fingerprint_pro_server_api_sdk.models.events_get_response import EventsGetResponse  # noqa: F401
from fingerprint_pro_server_api_sdk.models.events_update_request import EventsUpdateRequest  # noqa: F401
from fingerprint_pro_server_api_sdk.models.related_visitors_response import RelatedVisitorsResponse  # noqa: F401
from fingerprint_pro_server_api_sdk.models.search_events_response import SearchEventsResponse  # noqa: F401
from fingerprint_pro_server_api_sdk.models.visitors_get_response import VisitorsGetResponse  # noqa: F401


class FingerprintApi:
    """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, configuration: Optional[Configuration] = None, pool: Optional[Pool] = None):
        if configuration is None:
            raise ValueError("Missing the required parameter `configuration` when calling `FingerprintApi`")  # noqa: E501
        self.api_client = ApiClient(configuration, pool=pool)

    def delete_visitor_data(self, visitor_id: str, **kwargs) -> Union[None, AsyncResult[None]]:  # noqa: E501
        """Delete data by visitor ID  # noqa: E501

        Request deleting all data associated with the specified visitor ID. This API is useful for compliance with privacy regulations. ### Which data is deleted? - Browser (or device) properties - Identification requests made from this browser (or device)  #### Browser (or device) properties - Represents the data that Fingerprint collected from this specific browser (or device) and everything inferred and derived from it. - Upon request to delete, this data is deleted asynchronously (typically within a few minutes) and it will no longer be used to identify this browser (or device) for your [Fingerprint Workspace](https://dev.fingerprint.com/docs/glossary#fingerprint-workspace).  #### Identification requests made from this browser (or device) - Fingerprint stores the identification requests made from a browser (or device) for up to 30 (or 90) days depending on your plan. To learn more, see [Data Retention](https://dev.fingerprint.com/docs/regions#data-retention). - Upon request to delete, the identification requests that were made by this browser   - Within the past 10 days are deleted within 24 hrs.   - Outside of 10 days are allowed to purge as per your data retention period.  ### Corollary After requesting to delete a visitor ID, - If the same browser (or device) requests to identify, it will receive a different visitor ID. - If you request [`/events` API](https://dev.fingerprint.com/reference/getevent) with a `request_id` that was made outside of the 10 days, you will still receive a valid response. - If you request [`/visitors` API](https://dev.fingerprint.com/reference/getvisits) for the deleted visitor ID, the response will include identification requests that were made outside of those 10 days.  ### Interested? Please [contact our support team](https://fingerprint.com/support/) to enable it for you. Otherwise, you will receive a 403.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_visitor_data(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_visitor_data_with_http_info(visitor_id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_visitor_data_with_http_info(visitor_id, **kwargs)  # noqa: E501
            return data

    def delete_visitor_data_with_http_info(self, visitor_id: str, **kwargs):  # noqa: E501
        """Delete data by visitor ID  # noqa: E501

        Request deleting all data associated with the specified visitor ID. This API is useful for compliance with privacy regulations. ### Which data is deleted? - Browser (or device) properties - Identification requests made from this browser (or device)  #### Browser (or device) properties - Represents the data that Fingerprint collected from this specific browser (or device) and everything inferred and derived from it. - Upon request to delete, this data is deleted asynchronously (typically within a few minutes) and it will no longer be used to identify this browser (or device) for your [Fingerprint Workspace](https://dev.fingerprint.com/docs/glossary#fingerprint-workspace).  #### Identification requests made from this browser (or device) - Fingerprint stores the identification requests made from a browser (or device) for up to 30 (or 90) days depending on your plan. To learn more, see [Data Retention](https://dev.fingerprint.com/docs/regions#data-retention). - Upon request to delete, the identification requests that were made by this browser   - Within the past 10 days are deleted within 24 hrs.   - Outside of 10 days are allowed to purge as per your data retention period.  ### Corollary After requesting to delete a visitor ID, - If the same browser (or device) requests to identify, it will receive a different visitor ID. - If you request [`/events` API](https://dev.fingerprint.com/reference/getevent) with a `request_id` that was made outside of the 10 days, you will still receive a valid response. - If you request [`/visitors` API](https://dev.fingerprint.com/reference/getvisits) for the deleted visitor ID, the response will include identification requests that were made outside of those 10 days.  ### Interested? Please [contact our support team](https://fingerprint.com/support/) to enable it for you. Otherwise, you will receive a 403.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_visitor_data_with_http_info(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'visitor_id',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_visitor_data" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'visitor_id' is set
        if 'visitor_id' not in params or params['visitor_id'] is None:
            raise ValueError("Missing the required parameter `visitor_id` when calling `delete_visitor_data`")  # noqa: E501

        collection_formats = {}

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

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]

        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 = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/visitors/{visitor_id}', 'DELETE',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type=None,  # 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)
        except ApiException as e:
            if e.status == 400:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 404:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 429:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            raise e

    def get_event(self, request_id: str, **kwargs) -> Union[EventsGetResponse, AsyncResult[EventsGetResponse]]:  # noqa: E501
        """Get event by request ID  # noqa: E501

        Get a detailed analysis of an individual identification event, including Smart Signals.  Please note that the response includes mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. It is highly recommended that you **ignore** the mobile signals for such requests.   Use `requestId` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `requestId`.   # 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_event(request_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param request_id: The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
        :return: EventsGetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_event_with_http_info(request_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_event_with_http_info(request_id, **kwargs)  # noqa: E501
            return data

    def get_event_with_http_info(self, request_id: str, **kwargs):  # noqa: E501
        """Get event by request ID  # noqa: E501

        Get a detailed analysis of an individual identification event, including Smart Signals.  Please note that the response includes mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. It is highly recommended that you **ignore** the mobile signals for such requests.   Use `requestId` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `requestId`.   # 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_event_with_http_info(request_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str request_id: The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
        :return: EventsGetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'request_id',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_event" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'request_id' is set
        if 'request_id' not in params or params['request_id'] is None:
            raise ValueError("Missing the required parameter `request_id` when calling `get_event`")  # noqa: E501

        collection_formats = {}

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

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]

        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 = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/events/{request_id}', 'GET',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type='EventsGetResponse',  # 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)
        except ApiException as e:
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 404:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            raise e

    def get_related_visitors(self, visitor_id: str, **kwargs) -> Union[RelatedVisitorsResponse, AsyncResult[RelatedVisitorsResponse]]:  # noqa: E501
        """Get Related Visitors  # noqa: E501

        Related visitors API lets you link web visits and in-app browser visits that originated from the same mobile device. It searches the past 6 months of identification events to find the visitor IDs that belong to the same mobile device as the given visitor ID.  ⚠️ Please note that this API is not enabled by default and is billable separately. ⚠️  If you would like to use Related visitors API, please contact our [support team](https://fingerprint.com/support). To learn more, see [Related visitors API reference](https://dev.fingerprint.com/reference/related-visitors-api).   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_related_visitors(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
        :return: RelatedVisitorsResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_related_visitors_with_http_info(visitor_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_related_visitors_with_http_info(visitor_id, **kwargs)  # noqa: E501
            return data

    def get_related_visitors_with_http_info(self, visitor_id: str, **kwargs):  # noqa: E501
        """Get Related Visitors  # noqa: E501

        Related visitors API lets you link web visits and in-app browser visits that originated from the same mobile device. It searches the past 6 months of identification events to find the visitor IDs that belong to the same mobile device as the given visitor ID.  ⚠️ Please note that this API is not enabled by default and is billable separately. ⚠️  If you would like to use Related visitors API, please contact our [support team](https://fingerprint.com/support). To learn more, see [Related visitors API reference](https://dev.fingerprint.com/reference/related-visitors-api).   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_related_visitors_with_http_info(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
        :return: RelatedVisitorsResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'visitor_id',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_related_visitors" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'visitor_id' is set
        if 'visitor_id' not in params or params['visitor_id'] is None:
            raise ValueError("Missing the required parameter `visitor_id` when calling `get_related_visitors`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]
        if 'visitor_id' in params:
            query_params.append(('visitor_id', params['visitor_id']))  # 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 = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/related-visitors', 'GET',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type='RelatedVisitorsResponse',  # 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)
        except ApiException as e:
            if e.status == 400:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 404:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 429:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            raise e

    def get_visits(self, visitor_id: str, **kwargs) -> Union[VisitorsGetResponse, AsyncResult[VisitorsGetResponse]]:  # noqa: E501
        """Get visits by visitor ID  # noqa: E501

        Get a history of visits (identification events) for a specific `visitorId`. Use the `visitorId` as a URL path parameter. Only information from the _Identification_ product is returned.  #### Headers  * `Retry-After` — Present in case of `429 Too many requests`. Indicates how long you should wait before making a follow-up request. The value is non-negative decimal integer indicating the seconds to delay after the response is received.   # 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_visits(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
        :param request_id: Filter visits by `requestId`.   Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned. 
        :param linked_id: Filter visits by your custom identifier.   You can use [`linkedId`](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. 
        :param limit: Limit scanned results.   For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. 
        :param pagination_key: Use `paginationKey` to get the next page of results.   When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j`  Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. 
        :param before: ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. 
        :return: VisitorsGetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_visits_with_http_info(visitor_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_visits_with_http_info(visitor_id, **kwargs)  # noqa: E501
            return data

    def get_visits_with_http_info(self, visitor_id: str, **kwargs):  # noqa: E501
        """Get visits by visitor ID  # noqa: E501

        Get a history of visits (identification events) for a specific `visitorId`. Use the `visitorId` as a URL path parameter. Only information from the _Identification_ product is returned.  #### Headers  * `Retry-After` — Present in case of `429 Too many requests`. Indicates how long you should wait before making a follow-up request. The value is non-negative decimal integer indicating the seconds to delay after the response is received.   # 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_visits_with_http_info(visitor_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
        :param str request_id: Filter visits by `requestId`.   Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned. 
        :param str linked_id: Filter visits by your custom identifier.   You can use [`linkedId`](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. 
        :param int limit: Limit scanned results.   For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. 
        :param str pagination_key: Use `paginationKey` to get the next page of results.   When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j`  Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. 
        :param int before: ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. 
        :return: VisitorsGetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'visitor_id',
            'request_id',
            'linked_id',
            'limit',
            'pagination_key',
            'before',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_visits" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'visitor_id' is set
        if 'visitor_id' not in params or params['visitor_id'] is None:
            raise ValueError("Missing the required parameter `visitor_id` when calling `get_visits`")  # noqa: E501

        collection_formats = {}

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

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]
        if 'request_id' in params:
            query_params.append(('request_id', params['request_id']))  # noqa: E501
        if 'linked_id' in params:
            query_params.append(('linked_id', params['linked_id']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501
        if 'pagination_key' in params:
            query_params.append(('paginationKey', params['pagination_key']))  # noqa: E501
        if 'before' in params:
            query_params.append(('before', params['before']))  # 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 = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/visitors/{visitor_id}', 'GET',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type='VisitorsGetResponse',  # 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)
        except ApiException as e:
            if e.status == 400:
                error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
                raise extend_exception(e, error)
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
                raise extend_exception(e, error)
            if e.status == 429:
                error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
                raise extend_exception(e, error)
            raise e

    def search_events(self, limit: int, **kwargs) -> Union[SearchEventsResponse, AsyncResult[SearchEventsResponse]]:  # noqa: E501
        """Get events via search  # noqa: E501

        Search for identification events, including Smart Signals, using multiple filtering criteria. If you don't provide `start` or `end` parameters, the default search range is the last 7 days.  Please note that events include mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. We recommend you **ignore** mobile signals for such requests.   # 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_events(limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param limit: Limit the number of events returned.  (required)
        :param pagination_key: Use `pagination_key` to get the next page of results.   When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085` 
        :param visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`. 
        :param bot: Filter events by the Bot Detection result, specifically:    `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `products.botd.data.bot.result` property set to a valid value are returned. Events without a `products.botd` Smart Signal result are left out of the response. 
        :param ip_address: Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6)  All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32 
        :param linked_id: Filter events by your custom identifier.   You can use [linked IDs](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example, session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. 
        :param start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds). 
        :param end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds). 
        :param reverse: Sort events in reverse timestamp order. 
        :param suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. 
        :param vpn: Filter events by VPN Detection result.   > Note: When using this parameter, only events with the `products.vpn.data.result` property set to `true` or `false` are returned. Events without a `products.vpn` Smart Signal result are left out of the response. 
        :param virtual_machine: Filter events by Virtual Machine Detection result.   > Note: When using this parameter, only events with the `products.virtualMachine.data.result` property set to `true` or `false` are returned. Events without a `products.virtualMachine` Smart Signal result are left out of the response. 
        :param tampering: Filter events by Tampering Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.result` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. 
        :param anti_detect_browser: Filter events by Anti-detect Browser Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.antiDetectBrowser` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. 
        :param incognito: Filter events by Browser Incognito Detection result.   > Note: When using this parameter, only events with the `products.incognito.data.result` property set to `true` or `false` are returned. Events without a `products.incognito` Smart Signal result are left out of the response. 
        :param privacy_settings: Filter events by Privacy Settings Detection result.   > Note: When using this parameter, only events with the `products.privacySettings.data.result` property set to `true` or `false` are returned. Events without a `products.privacySettings` Smart Signal result are left out of the response. 
        :param jailbroken: Filter events by Jailbroken Device Detection result.   > Note: When using this parameter, only events with the `products.jailbroken.data.result` property set to `true` or `false` are returned. Events without a `products.jailbroken` Smart Signal result are left out of the response. 
        :param frida: Filter events by Frida Detection result.   > Note: When using this parameter, only events with the `products.frida.data.result` property set to `true` or `false` are returned. Events without a `products.frida` Smart Signal result are left out of the response. 
        :param factory_reset: Filter events by Factory Reset Detection result.   > Note: When using this parameter, only events with the `products.factoryReset.data.result` property set to `true` or `false` are returned. Events without a `products.factoryReset` Smart Signal result are left out of the response. 
        :param cloned_app: Filter events by Cloned App Detection result.   > Note: When using this parameter, only events with the `products.clonedApp.data.result` property set to `true` or `false` are returned. Events without a `products.clonedApp` Smart Signal result are left out of the response. 
        :param emulator: Filter events by Android Emulator Detection result.   > Note: When using this parameter, only events with the `products.emulator.data.result` property set to `true` or `false` are returned. Events without a `products.emulator` Smart Signal result are left out of the response. 
        :param root_apps: Filter events by Rooted Device Detection result.   > Note: When using this parameter, only events with the `products.rootApps.data.result` property set to `true` or `false` are returned. Events without a `products.rootApps` Smart Signal result are left out of the response. 
        :param vpn_confidence: Filter events by VPN Detection result confidence level.   `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `products.vpn.data.confidence` property set to a valid value are returned. Events without a `products.vpn` Smart Signal result are left out of the response. 
        :param min_suspect_score: Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `products.suspectScore.data.result` property set to a value exceeding your threshold are returned. Events without a `products.suspectScore` Smart Signal result are left out of the response. 
        :param ip_blocklist: Filter events by IP Blocklist Detection result.   > Note: When using this parameter, only events with the `products.ipBlocklist.data.result` property set to `true` or `false` are returned. Events without a `products.ipBlocklist` Smart Signal result are left out of the response. 
        :param datacenter: Filter events by Datacenter Detection result.   > Note: When using this parameter, only events with the `products.ipInfo.data.v4.datacenter.result` or `products.ipInfo.data.v6.datacenter.result` property set to `true` or `false` are returned. Events without a `products.ipInfo` Smart Signal result are left out of the response. 
        :param developer_tools: Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `products.developerTools.data.result` property set to `true` or `false` are returned. Events without a `products.developerTools` Smart Signal result are left out of the response. 
        :param location_spoofing: Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `products.locationSpoofing.data.result` property set to `true` or `false` are returned. Events without a `products.locationSpoofing` Smart Signal result are left out of the response. 
        :param mitm_attack: Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `products.mitmAttack.data.result` property set to `true` or `false` are returned. Events without a `products.mitmAttack` Smart Signal result are left out of the response. 
        :param proxy: Filter events by Proxy detection result. > Note: When using this parameter, only events with the `products.proxy.data.result` property set to `true` or `false` are returned. Events without a `products.proxy` Smart Signal result are left out of the response. 
        :param sdk_version: Filter events by a specific SDK version associated with the identification event. Example: `3.11.14` 
        :param sdk_platform: Filter events by the SDK Platform associated with the identification event. `js` - JavaScript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. 
        :param environment: Filter for events by providing one or more environment IDs. 
        :param proximity_id: Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `products.proximity.id` property matching the provided ID are returned. Events without a `products.proximity` result are left out of the response. 
        :param proximity_precision_radius: Filter events by Proximity Radius. > Note: When using this parameter, only events with the `products.proximity.precisionRadius` property set to a valid value are returned. Events without a `products.proximity` result are left out of the response. 
        :return: SearchEventsResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.search_events_with_http_info(limit, **kwargs)  # noqa: E501
        else:
            (data) = self.search_events_with_http_info(limit, **kwargs)  # noqa: E501
            return data

    def search_events_with_http_info(self, limit: int, **kwargs):  # noqa: E501
        """Get events via search  # noqa: E501

        Search for identification events, including Smart Signals, using multiple filtering criteria. If you don't provide `start` or `end` parameters, the default search range is the last 7 days.  Please note that events include mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. We recommend you **ignore** mobile signals for such requests.   # 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_events_with_http_info(limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int limit: Limit the number of events returned.  (required)
        :param str pagination_key: Use `pagination_key` to get the next page of results.   When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085` 
        :param str visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`. 
        :param str bot: Filter events by the Bot Detection result, specifically:    `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `products.botd.data.bot.result` property set to a valid value are returned. Events without a `products.botd` Smart Signal result are left out of the response. 
        :param str ip_address: Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6)  All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32 
        :param str linked_id: Filter events by your custom identifier.   You can use [linked IDs](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example, session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. 
        :param int start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds). 
        :param int end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds). 
        :param bool reverse: Sort events in reverse timestamp order. 
        :param bool suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. 
        :param bool vpn: Filter events by VPN Detection result.   > Note: When using this parameter, only events with the `products.vpn.data.result` property set to `true` or `false` are returned. Events without a `products.vpn` Smart Signal result are left out of the response. 
        :param bool virtual_machine: Filter events by Virtual Machine Detection result.   > Note: When using this parameter, only events with the `products.virtualMachine.data.result` property set to `true` or `false` are returned. Events without a `products.virtualMachine` Smart Signal result are left out of the response. 
        :param bool tampering: Filter events by Tampering Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.result` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. 
        :param bool anti_detect_browser: Filter events by Anti-detect Browser Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.antiDetectBrowser` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. 
        :param bool incognito: Filter events by Browser Incognito Detection result.   > Note: When using this parameter, only events with the `products.incognito.data.result` property set to `true` or `false` are returned. Events without a `products.incognito` Smart Signal result are left out of the response. 
        :param bool privacy_settings: Filter events by Privacy Settings Detection result.   > Note: When using this parameter, only events with the `products.privacySettings.data.result` property set to `true` or `false` are returned. Events without a `products.privacySettings` Smart Signal result are left out of the response. 
        :param bool jailbroken: Filter events by Jailbroken Device Detection result.   > Note: When using this parameter, only events with the `products.jailbroken.data.result` property set to `true` or `false` are returned. Events without a `products.jailbroken` Smart Signal result are left out of the response. 
        :param bool frida: Filter events by Frida Detection result.   > Note: When using this parameter, only events with the `products.frida.data.result` property set to `true` or `false` are returned. Events without a `products.frida` Smart Signal result are left out of the response. 
        :param bool factory_reset: Filter events by Factory Reset Detection result.   > Note: When using this parameter, only events with the `products.factoryReset.data.result` property set to `true` or `false` are returned. Events without a `products.factoryReset` Smart Signal result are left out of the response. 
        :param bool cloned_app: Filter events by Cloned App Detection result.   > Note: When using this parameter, only events with the `products.clonedApp.data.result` property set to `true` or `false` are returned. Events without a `products.clonedApp` Smart Signal result are left out of the response. 
        :param bool emulator: Filter events by Android Emulator Detection result.   > Note: When using this parameter, only events with the `products.emulator.data.result` property set to `true` or `false` are returned. Events without a `products.emulator` Smart Signal result are left out of the response. 
        :param bool root_apps: Filter events by Rooted Device Detection result.   > Note: When using this parameter, only events with the `products.rootApps.data.result` property set to `true` or `false` are returned. Events without a `products.rootApps` Smart Signal result are left out of the response. 
        :param str vpn_confidence: Filter events by VPN Detection result confidence level.   `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `products.vpn.data.confidence` property set to a valid value are returned. Events without a `products.vpn` Smart Signal result are left out of the response. 
        :param float min_suspect_score: Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `products.suspectScore.data.result` property set to a value exceeding your threshold are returned. Events without a `products.suspectScore` Smart Signal result are left out of the response. 
        :param bool ip_blocklist: Filter events by IP Blocklist Detection result.   > Note: When using this parameter, only events with the `products.ipBlocklist.data.result` property set to `true` or `false` are returned. Events without a `products.ipBlocklist` Smart Signal result are left out of the response. 
        :param bool datacenter: Filter events by Datacenter Detection result.   > Note: When using this parameter, only events with the `products.ipInfo.data.v4.datacenter.result` or `products.ipInfo.data.v6.datacenter.result` property set to `true` or `false` are returned. Events without a `products.ipInfo` Smart Signal result are left out of the response. 
        :param bool developer_tools: Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `products.developerTools.data.result` property set to `true` or `false` are returned. Events without a `products.developerTools` Smart Signal result are left out of the response. 
        :param bool location_spoofing: Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `products.locationSpoofing.data.result` property set to `true` or `false` are returned. Events without a `products.locationSpoofing` Smart Signal result are left out of the response. 
        :param bool mitm_attack: Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `products.mitmAttack.data.result` property set to `true` or `false` are returned. Events without a `products.mitmAttack` Smart Signal result are left out of the response. 
        :param bool proxy: Filter events by Proxy detection result. > Note: When using this parameter, only events with the `products.proxy.data.result` property set to `true` or `false` are returned. Events without a `products.proxy` Smart Signal result are left out of the response. 
        :param str sdk_version: Filter events by a specific SDK version associated with the identification event. Example: `3.11.14` 
        :param str sdk_platform: Filter events by the SDK Platform associated with the identification event. `js` - JavaScript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. 
        :param list[str] environment: Filter for events by providing one or more environment IDs. 
        :param str proximity_id: Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `products.proximity.id` property matching the provided ID are returned. Events without a `products.proximity` result are left out of the response. 
        :param int proximity_precision_radius: Filter events by Proximity Radius. > Note: When using this parameter, only events with the `products.proximity.precisionRadius` property set to a valid value are returned. Events without a `products.proximity` result are left out of the response. 
        :return: SearchEventsResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'limit',
            'pagination_key',
            'visitor_id',
            'bot',
            'ip_address',
            'linked_id',
            'start',
            'end',
            'reverse',
            'suspect',
            'vpn',
            'virtual_machine',
            'tampering',
            'anti_detect_browser',
            'incognito',
            'privacy_settings',
            'jailbroken',
            'frida',
            'factory_reset',
            'cloned_app',
            'emulator',
            'root_apps',
            'vpn_confidence',
            'min_suspect_score',
            'ip_blocklist',
            'datacenter',
            'developer_tools',
            'location_spoofing',
            'mitm_attack',
            'proxy',
            'sdk_version',
            'sdk_platform',
            'environment',
            'proximity_id',
            'proximity_precision_radius',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search_events" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'limit' is set
        if 'limit' not in params or params['limit'] is None:
            raise ValueError("Missing the required parameter `limit` when calling `search_events`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501
        if 'pagination_key' in params:
            query_params.append(('pagination_key', params['pagination_key']))  # noqa: E501
        if 'visitor_id' in params:
            query_params.append(('visitor_id', params['visitor_id']))  # noqa: E501
        if 'bot' in params:
            query_params.append(('bot', params['bot']))  # noqa: E501
        if 'ip_address' in params:
            query_params.append(('ip_address', params['ip_address']))  # noqa: E501
        if 'linked_id' in params:
            query_params.append(('linked_id', params['linked_id']))  # noqa: E501
        if 'start' in params:
            query_params.append(('start', params['start']))  # noqa: E501
        if 'end' in params:
            query_params.append(('end', params['end']))  # noqa: E501
        if 'reverse' in params:
            query_params.append(('reverse', params['reverse']))  # noqa: E501
        if 'suspect' in params:
            query_params.append(('suspect', params['suspect']))  # noqa: E501
        if 'vpn' in params:
            query_params.append(('vpn', params['vpn']))  # noqa: E501
        if 'virtual_machine' in params:
            query_params.append(('virtual_machine', params['virtual_machine']))  # noqa: E501
        if 'tampering' in params:
            query_params.append(('tampering', params['tampering']))  # noqa: E501
        if 'anti_detect_browser' in params:
            query_params.append(('anti_detect_browser', params['anti_detect_browser']))  # noqa: E501
        if 'incognito' in params:
            query_params.append(('incognito', params['incognito']))  # noqa: E501
        if 'privacy_settings' in params:
            query_params.append(('privacy_settings', params['privacy_settings']))  # noqa: E501
        if 'jailbroken' in params:
            query_params.append(('jailbroken', params['jailbroken']))  # noqa: E501
        if 'frida' in params:
            query_params.append(('frida', params['frida']))  # noqa: E501
        if 'factory_reset' in params:
            query_params.append(('factory_reset', params['factory_reset']))  # noqa: E501
        if 'cloned_app' in params:
            query_params.append(('cloned_app', params['cloned_app']))  # noqa: E501
        if 'emulator' in params:
            query_params.append(('emulator', params['emulator']))  # noqa: E501
        if 'root_apps' in params:
            query_params.append(('root_apps', params['root_apps']))  # noqa: E501
        if 'vpn_confidence' in params:
            query_params.append(('vpn_confidence', params['vpn_confidence']))  # noqa: E501
        if 'min_suspect_score' in params:
            query_params.append(('min_suspect_score', params['min_suspect_score']))  # noqa: E501
        if 'ip_blocklist' in params:
            query_params.append(('ip_blocklist', params['ip_blocklist']))  # noqa: E501
        if 'datacenter' in params:
            query_params.append(('datacenter', params['datacenter']))  # noqa: E501
        if 'developer_tools' in params:
            query_params.append(('developer_tools', params['developer_tools']))  # noqa: E501
        if 'location_spoofing' in params:
            query_params.append(('location_spoofing', params['location_spoofing']))  # noqa: E501
        if 'mitm_attack' in params:
            query_params.append(('mitm_attack', params['mitm_attack']))  # noqa: E501
        if 'proxy' in params:
            query_params.append(('proxy', params['proxy']))  # noqa: E501
        if 'sdk_version' in params:
            query_params.append(('sdk_version', params['sdk_version']))  # noqa: E501
        if 'sdk_platform' in params:
            query_params.append(('sdk_platform', params['sdk_platform']))  # noqa: E501
        if 'environment' in params:
            query_params.append(('environment', params['environment']))  # noqa: E501
            collection_formats['environment'] = 'multi'  # noqa: E501
        if 'proximity_id' in params:
            query_params.append(('proximity_id', params['proximity_id']))  # noqa: E501
        if 'proximity_precision_radius' in params:
            query_params.append(('proximity_precision_radius', params['proximity_precision_radius']))  # 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 = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/events/search', 'GET',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type='SearchEventsResponse',  # 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)
        except ApiException as e:
            if e.status == 400:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            raise e

    def update_event(self, body: EventsUpdateRequest, request_id: str, **kwargs) -> Union[None, AsyncResult[None]]:  # noqa: E501
        """Update an event with a given request ID  # noqa: E501

        Change information in existing events specified by `requestId` or *flag suspicious events*.  When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact.  **Warning** It's not possible to update events older than 10 days.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_event(body, request_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param body: (required)
        :param request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_event_with_http_info(body, request_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_event_with_http_info(body, request_id, **kwargs)  # noqa: E501
            return data

    def update_event_with_http_info(self, body: EventsUpdateRequest, request_id: str, **kwargs):  # noqa: E501
        """Update an event with a given request ID  # noqa: E501

        Change information in existing events specified by `requestId` or *flag suspicious events*.  When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact.  **Warning** It's not possible to update events older than 10 days.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_event_with_http_info(body, request_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param EventsUpdateRequest body: (required)
        :param str request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            'body',
            'request_id',
            'async_req',
            '_return_http_data_only',
            '_preload_content',
            '_request_timeout']

        params = locals()
        for key, val in params['kwargs'].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_event" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if 'body' not in params or params['body'] is None:
            raise ValueError("Missing the required parameter `body` when calling `update_event`")  # noqa: E501
        # verify the required parameter 'request_id' is set
        if 'request_id' not in params or params['request_id'] is None:
            raise ValueError("Missing the required parameter `request_id` when calling `update_event`")  # noqa: E501

        collection_formats = {}

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

        query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.11.0')]

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['ApiKeyHeader', 'ApiKeyQuery']  # noqa: E501

        try:
            return self.api_client.call_api(
                '/events/{request_id}', 'PUT',
                path_params,
                query_params,
                header_params,
                body=body_params,
                post_params=form_params,
                files=local_var_files,
                response_type=None,  # 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)
        except ApiException as e:
            if e.status == 400:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 403:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 404:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            if e.status == 409:
                error = self.api_client.deserialize(e, 'ErrorResponse', True)
                raise extend_exception(e, error)
            raise e
