From 9b313677da304c8090518f484406694c7b1123b8 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 16 Jul 2024 18:28:39 +0200 Subject: [PATCH] feat: add `velocity` signal --- README.md | 4 + docs/ProductsResponse.md | 1 + docs/SignalResponseVelocity.md | 10 + docs/VelocityIntervalResult.md | 13 ++ docs/VelocityIntervals.md | 9 + docs/VelocityResult.md | 14 ++ docs/WebhookVisit.md | 1 + fingerprint_pro_server_api_sdk/__init__.py | 4 + .../models/__init__.py | 4 + .../models/products_response.py | 32 ++- .../models/signal_response_velocity.py | 139 ++++++++++++ .../models/velocity_interval_result.py | 172 +++++++++++++++ .../models/velocity_intervals.py | 113 ++++++++++ .../models/velocity_result.py | 198 ++++++++++++++++++ .../models/webhook_visit.py | 28 ++- res/fingerprint-server-api.yaml | 88 ++++++++ test/mocks/get_event_200.json | 28 ++- test/mocks/get_event_200_all_errors.json | 6 + test/mocks/webhook.json | 24 +++ 19 files changed, 883 insertions(+), 5 deletions(-) create mode 100644 docs/SignalResponseVelocity.md create mode 100644 docs/VelocityIntervalResult.md create mode 100644 docs/VelocityIntervals.md create mode 100644 docs/VelocityResult.md create mode 100644 fingerprint_pro_server_api_sdk/models/signal_response_velocity.py create mode 100644 fingerprint_pro_server_api_sdk/models/velocity_interval_result.py create mode 100644 fingerprint_pro_server_api_sdk/models/velocity_intervals.py create mode 100644 fingerprint_pro_server_api_sdk/models/velocity_result.py diff --git a/README.md b/README.md index 1a2f956f..6e578c48 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,7 @@ Class | Method | HTTP request | Description - [SignalResponseSuspectScore](docs/SignalResponseSuspectScore.md) - [SignalResponseTampering](docs/SignalResponseTampering.md) - [SignalResponseTor](docs/SignalResponseTor.md) + - [SignalResponseVelocity](docs/SignalResponseVelocity.md) - [SignalResponseVirtualMachine](docs/SignalResponseVirtualMachine.md) - [SignalResponseVpn](docs/SignalResponseVpn.md) - [Subdivision](docs/Subdivision.md) @@ -255,6 +256,9 @@ Class | Method | HTTP request | Description - [TamperingResult](docs/TamperingResult.md) - [TooManyRequestsResponse](docs/TooManyRequestsResponse.md) - [TorResult](docs/TorResult.md) + - [VelocityIntervalResult](docs/VelocityIntervalResult.md) + - [VelocityIntervals](docs/VelocityIntervals.md) + - [VelocityResult](docs/VelocityResult.md) - [VirtualMachineResult](docs/VirtualMachineResult.md) - [Visit](docs/Visit.md) - [VpnResult](docs/VpnResult.md) diff --git a/docs/ProductsResponse.md b/docs/ProductsResponse.md index 35479a59..e8abb006 100644 --- a/docs/ProductsResponse.md +++ b/docs/ProductsResponse.md @@ -27,6 +27,7 @@ Name | Type | Description | Notes **suspect_score** | [**SignalResponseSuspectScore**](SignalResponseSuspectScore.md) | | [optional] **raw_device_attributes** | [**SignalResponseRawDeviceAttributes**](SignalResponseRawDeviceAttributes.md) | | [optional] **remote_control** | [**SignalResponseRemoteControl**](SignalResponseRemoteControl.md) | | [optional] +**velocity** | [**SignalResponseVelocity**](SignalResponseVelocity.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SignalResponseVelocity.md b/docs/SignalResponseVelocity.md new file mode 100644 index 00000000..c1702ccb --- /dev/null +++ b/docs/SignalResponseVelocity.md @@ -0,0 +1,10 @@ +# SignalResponseVelocity + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**VelocityResult**](VelocityResult.md) | | [optional] +**error** | [**ProductError**](ProductError.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/VelocityIntervalResult.md b/docs/VelocityIntervalResult.md new file mode 100644 index 00000000..93206bbf --- /dev/null +++ b/docs/VelocityIntervalResult.md @@ -0,0 +1,13 @@ +# VelocityIntervalResult +Is absent if the velocity data could not be generated for the visitor ID. + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_5m** | **int** | | +**_1h** | **int** | | +**_24h** | **int** | The `24h` interval of `distinctIp`, `distinctLinkedId`, and `distinctCountry` will be omitted if the number of `events`` for the visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher than 20.000. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/VelocityIntervals.md b/docs/VelocityIntervals.md new file mode 100644 index 00000000..6f3f6bb7 --- /dev/null +++ b/docs/VelocityIntervals.md @@ -0,0 +1,9 @@ +# VelocityIntervals + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**intervals** | [**VelocityIntervalResult**](VelocityIntervalResult.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/VelocityResult.md b/docs/VelocityResult.md new file mode 100644 index 00000000..fb6e0236 --- /dev/null +++ b/docs/VelocityResult.md @@ -0,0 +1,14 @@ +# VelocityResult +Sums key data points for a specific `visitorId` at three distinct time intervals: 5 minutes, 1 hour, and 24 hours as follows: - Number of identification events attributed to the visitor ID - Number of distinct IP addresses associated to the visitor ID. - Number of distinct countries associated with the visitor ID. - Number of distinct `linkedId`s associated with the visitor ID. The `24h` interval of `distinctIp`, `distinctLinkedId`, and `distinctCountry` will be omitted if the number of `events` for the visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher than 20.000. + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**distinct_ip** | [**VelocityIntervals**](VelocityIntervals.md) | | +**distinct_linked_id** | [**VelocityIntervals**](VelocityIntervals.md) | | +**distinct_country** | [**VelocityIntervals**](VelocityIntervals.md) | | +**events** | [**VelocityIntervals**](VelocityIntervals.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WebhookVisit.md b/docs/WebhookVisit.md index 85e82dec..f4a3d87c 100644 --- a/docs/WebhookVisit.md +++ b/docs/WebhookVisit.md @@ -27,6 +27,7 @@ Name | Type | Description | Notes **location_spoofing** | [**LocationSpoofingResult**](LocationSpoofingResult.md) | | [optional] **suspect_score** | [**SuspectScoreResult**](SuspectScoreResult.md) | | [optional] **remote_control** | [**RemoteControlResult**](RemoteControlResult.md) | | [optional] +**velocity** | [**VelocityResult**](VelocityResult.md) | | [optional] **request_id** | **str** | Unique identifier of the user's identification request. | **browser_details** | [**BrowserDetails**](BrowserDetails.md) | | **ip** | **str** | | diff --git a/fingerprint_pro_server_api_sdk/__init__.py b/fingerprint_pro_server_api_sdk/__init__.py index e40ea761..ff47fe5e 100644 --- a/fingerprint_pro_server_api_sdk/__init__.py +++ b/fingerprint_pro_server_api_sdk/__init__.py @@ -93,6 +93,7 @@ from fingerprint_pro_server_api_sdk.models.signal_response_suspect_score import SignalResponseSuspectScore from fingerprint_pro_server_api_sdk.models.signal_response_tampering import SignalResponseTampering from fingerprint_pro_server_api_sdk.models.signal_response_tor import SignalResponseTor +from fingerprint_pro_server_api_sdk.models.signal_response_velocity import SignalResponseVelocity from fingerprint_pro_server_api_sdk.models.signal_response_virtual_machine import SignalResponseVirtualMachine from fingerprint_pro_server_api_sdk.models.signal_response_vpn import SignalResponseVpn from fingerprint_pro_server_api_sdk.models.subdivision import Subdivision @@ -100,6 +101,9 @@ from fingerprint_pro_server_api_sdk.models.tampering_result import TamperingResult from fingerprint_pro_server_api_sdk.models.too_many_requests_response import TooManyRequestsResponse from fingerprint_pro_server_api_sdk.models.tor_result import TorResult +from fingerprint_pro_server_api_sdk.models.velocity_interval_result import VelocityIntervalResult +from fingerprint_pro_server_api_sdk.models.velocity_intervals import VelocityIntervals +from fingerprint_pro_server_api_sdk.models.velocity_result import VelocityResult from fingerprint_pro_server_api_sdk.models.virtual_machine_result import VirtualMachineResult from fingerprint_pro_server_api_sdk.models.visit import Visit from fingerprint_pro_server_api_sdk.models.vpn_result import VpnResult diff --git a/fingerprint_pro_server_api_sdk/models/__init__.py b/fingerprint_pro_server_api_sdk/models/__init__.py index edf6a443..703d4ba0 100644 --- a/fingerprint_pro_server_api_sdk/models/__init__.py +++ b/fingerprint_pro_server_api_sdk/models/__init__.py @@ -87,6 +87,7 @@ from fingerprint_pro_server_api_sdk.models.signal_response_suspect_score import SignalResponseSuspectScore from fingerprint_pro_server_api_sdk.models.signal_response_tampering import SignalResponseTampering from fingerprint_pro_server_api_sdk.models.signal_response_tor import SignalResponseTor +from fingerprint_pro_server_api_sdk.models.signal_response_velocity import SignalResponseVelocity from fingerprint_pro_server_api_sdk.models.signal_response_virtual_machine import SignalResponseVirtualMachine from fingerprint_pro_server_api_sdk.models.signal_response_vpn import SignalResponseVpn from fingerprint_pro_server_api_sdk.models.subdivision import Subdivision @@ -94,6 +95,9 @@ from fingerprint_pro_server_api_sdk.models.tampering_result import TamperingResult from fingerprint_pro_server_api_sdk.models.too_many_requests_response import TooManyRequestsResponse from fingerprint_pro_server_api_sdk.models.tor_result import TorResult +from fingerprint_pro_server_api_sdk.models.velocity_interval_result import VelocityIntervalResult +from fingerprint_pro_server_api_sdk.models.velocity_intervals import VelocityIntervals +from fingerprint_pro_server_api_sdk.models.velocity_result import VelocityResult from fingerprint_pro_server_api_sdk.models.virtual_machine_result import VirtualMachineResult from fingerprint_pro_server_api_sdk.models.visit import Visit from fingerprint_pro_server_api_sdk.models.vpn_result import VpnResult diff --git a/fingerprint_pro_server_api_sdk/models/products_response.py b/fingerprint_pro_server_api_sdk/models/products_response.py index c5597e26..c752a710 100644 --- a/fingerprint_pro_server_api_sdk/models/products_response.py +++ b/fingerprint_pro_server_api_sdk/models/products_response.py @@ -52,7 +52,8 @@ class ProductsResponse(object): 'location_spoofing': 'SignalResponseLocationSpoofing', 'suspect_score': 'SignalResponseSuspectScore', 'raw_device_attributes': 'SignalResponseRawDeviceAttributes', - 'remote_control': 'SignalResponseRemoteControl' + 'remote_control': 'SignalResponseRemoteControl', + 'velocity': 'SignalResponseVelocity' } attribute_map = { @@ -77,10 +78,11 @@ class ProductsResponse(object): 'location_spoofing': 'locationSpoofing', 'suspect_score': 'suspectScore', 'raw_device_attributes': 'rawDeviceAttributes', - 'remote_control': 'remoteControl' + 'remote_control': 'remoteControl', + 'velocity': 'velocity' } - def __init__(self, identification=None, botd=None, ip_info=None, incognito=None, root_apps=None, emulator=None, cloned_app=None, factory_reset=None, jailbroken=None, frida=None, ip_blocklist=None, tor=None, privacy_settings=None, virtual_machine=None, vpn=None, proxy=None, tampering=None, high_activity=None, location_spoofing=None, suspect_score=None, raw_device_attributes=None, remote_control=None): # noqa: E501 + def __init__(self, identification=None, botd=None, ip_info=None, incognito=None, root_apps=None, emulator=None, cloned_app=None, factory_reset=None, jailbroken=None, frida=None, ip_blocklist=None, tor=None, privacy_settings=None, virtual_machine=None, vpn=None, proxy=None, tampering=None, high_activity=None, location_spoofing=None, suspect_score=None, raw_device_attributes=None, remote_control=None, velocity=None): # noqa: E501 """ProductsResponse - a model defined in Swagger""" # noqa: E501 self._identification = None self._botd = None @@ -104,6 +106,7 @@ def __init__(self, identification=None, botd=None, ip_info=None, incognito=None, self._suspect_score = None self._raw_device_attributes = None self._remote_control = None + self._velocity = None self.discriminator = None if identification is not None: self.identification = identification @@ -149,6 +152,8 @@ def __init__(self, identification=None, botd=None, ip_info=None, incognito=None, self.raw_device_attributes = raw_device_attributes if remote_control is not None: self.remote_control = remote_control + if velocity is not None: + self.velocity = velocity @property def identification(self): @@ -612,6 +617,27 @@ def remote_control(self, remote_control): self._remote_control = remote_control + @property + def velocity(self): + """Gets the velocity of this ProductsResponse. # noqa: E501 + + + :return: The velocity of this ProductsResponse. # noqa: E501 + :rtype: SignalResponseVelocity + """ + return self._velocity + + @velocity.setter + def velocity(self, velocity): + """Sets the velocity of this ProductsResponse. + + + :param velocity: The velocity of this ProductsResponse. # noqa: E501 + :type: SignalResponseVelocity + """ + + self._velocity = velocity + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/fingerprint_pro_server_api_sdk/models/signal_response_velocity.py b/fingerprint_pro_server_api_sdk/models/signal_response_velocity.py new file mode 100644 index 00000000..12e55c90 --- /dev/null +++ b/fingerprint_pro_server_api_sdk/models/signal_response_velocity.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Fingerprint Pro Server API + + Fingerprint Pro Server API allows you to get information about visitors and about individual 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 pprint +import re # noqa: F401 + +import six + +class SignalResponseVelocity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'VelocityResult', + 'error': 'ProductError' + } + + attribute_map = { + 'data': 'data', + 'error': 'error' + } + + def __init__(self, data=None, error=None): # noqa: E501 + """SignalResponseVelocity - a model defined in Swagger""" # noqa: E501 + self._data = None + self._error = None + self.discriminator = None + if data is not None: + self.data = data + if error is not None: + self.error = error + + @property + def data(self): + """Gets the data of this SignalResponseVelocity. # noqa: E501 + + + :return: The data of this SignalResponseVelocity. # noqa: E501 + :rtype: VelocityResult + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this SignalResponseVelocity. + + + :param data: The data of this SignalResponseVelocity. # noqa: E501 + :type: VelocityResult + """ + + self._data = data + + @property + def error(self): + """Gets the error of this SignalResponseVelocity. # noqa: E501 + + + :return: The error of this SignalResponseVelocity. # noqa: E501 + :rtype: ProductError + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this SignalResponseVelocity. + + + :param error: The error of this SignalResponseVelocity. # noqa: E501 + :type: ProductError + """ + + self._error = error + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignalResponseVelocity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignalResponseVelocity): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, SignalResponseVelocity): + return True + + return self.to_dict() != other.to_dict() diff --git a/fingerprint_pro_server_api_sdk/models/velocity_interval_result.py b/fingerprint_pro_server_api_sdk/models/velocity_interval_result.py new file mode 100644 index 00000000..8b555c19 --- /dev/null +++ b/fingerprint_pro_server_api_sdk/models/velocity_interval_result.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Fingerprint Pro Server API + + Fingerprint Pro Server API allows you to get information about visitors and about individual 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 pprint +import re # noqa: F401 + +import six + +class VelocityIntervalResult(object): + """ + Is absent if the velocity data could not be generated for the visitor ID. + + NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_5m': 'int', + '_1h': 'int', + '_24h': 'int' + } + + attribute_map = { + '_5m': '5m', + '_1h': '1h', + '_24h': '24h' + } + + def __init__(self, _5m=None, _1h=None, _24h=None): # noqa: E501 + """VelocityIntervalResult - a model defined in Swagger""" # noqa: E501 + self.__5m = None + self.__1h = None + self.__24h = None + self.discriminator = None + self._5m = _5m + self._1h = _1h + if _24h is not None: + self._24h = _24h + + @property + def _5m(self): + """Gets the _5m of this VelocityIntervalResult. # noqa: E501 + + + :return: The _5m of this VelocityIntervalResult. # noqa: E501 + :rtype: int + """ + return self.__5m + + @_5m.setter + def _5m(self, _5m): + """Sets the _5m of this VelocityIntervalResult. + + + :param _5m: The _5m of this VelocityIntervalResult. # noqa: E501 + :type: int + """ + if _5m is None: + raise ValueError("Invalid value for `_5m`, must not be `None`") # noqa: E501 + + self.__5m = _5m + + @property + def _1h(self): + """Gets the _1h of this VelocityIntervalResult. # noqa: E501 + + + :return: The _1h of this VelocityIntervalResult. # noqa: E501 + :rtype: int + """ + return self.__1h + + @_1h.setter + def _1h(self, _1h): + """Sets the _1h of this VelocityIntervalResult. + + + :param _1h: The _1h of this VelocityIntervalResult. # noqa: E501 + :type: int + """ + if _1h is None: + raise ValueError("Invalid value for `_1h`, must not be `None`") # noqa: E501 + + self.__1h = _1h + + @property + def _24h(self): + """Gets the _24h of this VelocityIntervalResult. # noqa: E501 + + The `24h` interval of `distinctIp`, `distinctLinkedId`, and `distinctCountry` will be omitted if the number of `events`` for the visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher than 20.000. # noqa: E501 + + :return: The _24h of this VelocityIntervalResult. # noqa: E501 + :rtype: int + """ + return self.__24h + + @_24h.setter + def _24h(self, _24h): + """Sets the _24h of this VelocityIntervalResult. + + The `24h` interval of `distinctIp`, `distinctLinkedId`, and `distinctCountry` will be omitted if the number of `events`` for the visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher than 20.000. # noqa: E501 + + :param _24h: The _24h of this VelocityIntervalResult. # noqa: E501 + :type: int + """ + + self.__24h = _24h + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VelocityIntervalResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VelocityIntervalResult): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, VelocityIntervalResult): + return True + + return self.to_dict() != other.to_dict() diff --git a/fingerprint_pro_server_api_sdk/models/velocity_intervals.py b/fingerprint_pro_server_api_sdk/models/velocity_intervals.py new file mode 100644 index 00000000..0e3e7079 --- /dev/null +++ b/fingerprint_pro_server_api_sdk/models/velocity_intervals.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Fingerprint Pro Server API + + Fingerprint Pro Server API allows you to get information about visitors and about individual 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 pprint +import re # noqa: F401 + +import six + +class VelocityIntervals(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'intervals': 'VelocityIntervalResult' + } + + attribute_map = { + 'intervals': 'intervals' + } + + def __init__(self, intervals=None): # noqa: E501 + """VelocityIntervals - a model defined in Swagger""" # noqa: E501 + self._intervals = None + self.discriminator = None + if intervals is not None: + self.intervals = intervals + + @property + def intervals(self): + """Gets the intervals of this VelocityIntervals. # noqa: E501 + + + :return: The intervals of this VelocityIntervals. # noqa: E501 + :rtype: VelocityIntervalResult + """ + return self._intervals + + @intervals.setter + def intervals(self, intervals): + """Sets the intervals of this VelocityIntervals. + + + :param intervals: The intervals of this VelocityIntervals. # noqa: E501 + :type: VelocityIntervalResult + """ + + self._intervals = intervals + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VelocityIntervals, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VelocityIntervals): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, VelocityIntervals): + return True + + return self.to_dict() != other.to_dict() diff --git a/fingerprint_pro_server_api_sdk/models/velocity_result.py b/fingerprint_pro_server_api_sdk/models/velocity_result.py new file mode 100644 index 00000000..943b7567 --- /dev/null +++ b/fingerprint_pro_server_api_sdk/models/velocity_result.py @@ -0,0 +1,198 @@ +# coding: utf-8 + +""" + Fingerprint Pro Server API + + Fingerprint Pro Server API allows you to get information about visitors and about individual 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 pprint +import re # noqa: F401 + +import six + +class VelocityResult(object): + """ + Sums key data points for a specific `visitorId` at three distinct time intervals: 5 minutes, 1 hour, and 24 hours as follows: - Number of identification events attributed to the visitor ID - Number of distinct IP addresses associated to the visitor ID. - Number of distinct countries associated with the visitor ID. - Number of distinct `linkedId`s associated with the visitor ID. The `24h` interval of `distinctIp`, `distinctLinkedId`, and `distinctCountry` will be omitted if the number of `events` for the visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher than 20.000. + + NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'distinct_ip': 'VelocityIntervals', + 'distinct_linked_id': 'VelocityIntervals', + 'distinct_country': 'VelocityIntervals', + 'events': 'VelocityIntervals' + } + + attribute_map = { + 'distinct_ip': 'distinctIp', + 'distinct_linked_id': 'distinctLinkedId', + 'distinct_country': 'distinctCountry', + 'events': 'events' + } + + def __init__(self, distinct_ip=None, distinct_linked_id=None, distinct_country=None, events=None): # noqa: E501 + """VelocityResult - a model defined in Swagger""" # noqa: E501 + self._distinct_ip = None + self._distinct_linked_id = None + self._distinct_country = None + self._events = None + self.discriminator = None + self.distinct_ip = distinct_ip + self.distinct_linked_id = distinct_linked_id + self.distinct_country = distinct_country + self.events = events + + @property + def distinct_ip(self): + """Gets the distinct_ip of this VelocityResult. # noqa: E501 + + + :return: The distinct_ip of this VelocityResult. # noqa: E501 + :rtype: VelocityIntervals + """ + return self._distinct_ip + + @distinct_ip.setter + def distinct_ip(self, distinct_ip): + """Sets the distinct_ip of this VelocityResult. + + + :param distinct_ip: The distinct_ip of this VelocityResult. # noqa: E501 + :type: VelocityIntervals + """ + if distinct_ip is None: + raise ValueError("Invalid value for `distinct_ip`, must not be `None`") # noqa: E501 + + self._distinct_ip = distinct_ip + + @property + def distinct_linked_id(self): + """Gets the distinct_linked_id of this VelocityResult. # noqa: E501 + + + :return: The distinct_linked_id of this VelocityResult. # noqa: E501 + :rtype: VelocityIntervals + """ + return self._distinct_linked_id + + @distinct_linked_id.setter + def distinct_linked_id(self, distinct_linked_id): + """Sets the distinct_linked_id of this VelocityResult. + + + :param distinct_linked_id: The distinct_linked_id of this VelocityResult. # noqa: E501 + :type: VelocityIntervals + """ + if distinct_linked_id is None: + raise ValueError("Invalid value for `distinct_linked_id`, must not be `None`") # noqa: E501 + + self._distinct_linked_id = distinct_linked_id + + @property + def distinct_country(self): + """Gets the distinct_country of this VelocityResult. # noqa: E501 + + + :return: The distinct_country of this VelocityResult. # noqa: E501 + :rtype: VelocityIntervals + """ + return self._distinct_country + + @distinct_country.setter + def distinct_country(self, distinct_country): + """Sets the distinct_country of this VelocityResult. + + + :param distinct_country: The distinct_country of this VelocityResult. # noqa: E501 + :type: VelocityIntervals + """ + if distinct_country is None: + raise ValueError("Invalid value for `distinct_country`, must not be `None`") # noqa: E501 + + self._distinct_country = distinct_country + + @property + def events(self): + """Gets the events of this VelocityResult. # noqa: E501 + + + :return: The events of this VelocityResult. # noqa: E501 + :rtype: VelocityIntervals + """ + return self._events + + @events.setter + def events(self, events): + """Sets the events of this VelocityResult. + + + :param events: The events of this VelocityResult. # noqa: E501 + :type: VelocityIntervals + """ + if events is None: + raise ValueError("Invalid value for `events`, must not be `None`") # noqa: E501 + + self._events = events + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VelocityResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VelocityResult): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, VelocityResult): + return True + + return self.to_dict() != other.to_dict() diff --git a/fingerprint_pro_server_api_sdk/models/webhook_visit.py b/fingerprint_pro_server_api_sdk/models/webhook_visit.py index 5f62b11b..56ab15bb 100644 --- a/fingerprint_pro_server_api_sdk/models/webhook_visit.py +++ b/fingerprint_pro_server_api_sdk/models/webhook_visit.py @@ -52,6 +52,7 @@ class WebhookVisit(object): 'location_spoofing': 'LocationSpoofingResult', 'suspect_score': 'SuspectScoreResult', 'remote_control': 'RemoteControlResult', + 'velocity': 'VelocityResult', 'request_id': 'str', 'browser_details': 'BrowserDetails', 'ip': 'str', @@ -92,6 +93,7 @@ class WebhookVisit(object): 'location_spoofing': 'locationSpoofing', 'suspect_score': 'suspectScore', 'remote_control': 'remoteControl', + 'velocity': 'velocity', 'request_id': 'requestId', 'browser_details': 'browserDetails', 'ip': 'ip', @@ -107,7 +109,7 @@ class WebhookVisit(object): 'last_seen_at': 'lastSeenAt' } - def __init__(self, visitor_id=None, client_referrer=None, user_agent=None, bot=None, ip_info=None, incognito=None, root_apps=None, emulator=None, cloned_app=None, factory_reset=None, jailbroken=None, frida=None, ip_blocklist=None, tor=None, privacy_settings=None, virtual_machine=None, vpn=None, proxy=None, tampering=None, raw_device_attributes=None, high_activity=None, location_spoofing=None, suspect_score=None, remote_control=None, request_id=None, browser_details=None, ip=None, ip_location=None, timestamp=None, time=None, url=None, tag=None, linked_id=None, confidence=None, visitor_found=None, first_seen_at=None, last_seen_at=None): # noqa: E501 + def __init__(self, visitor_id=None, client_referrer=None, user_agent=None, bot=None, ip_info=None, incognito=None, root_apps=None, emulator=None, cloned_app=None, factory_reset=None, jailbroken=None, frida=None, ip_blocklist=None, tor=None, privacy_settings=None, virtual_machine=None, vpn=None, proxy=None, tampering=None, raw_device_attributes=None, high_activity=None, location_spoofing=None, suspect_score=None, remote_control=None, velocity=None, request_id=None, browser_details=None, ip=None, ip_location=None, timestamp=None, time=None, url=None, tag=None, linked_id=None, confidence=None, visitor_found=None, first_seen_at=None, last_seen_at=None): # noqa: E501 """WebhookVisit - a model defined in Swagger""" # noqa: E501 self._visitor_id = None self._client_referrer = None @@ -133,6 +135,7 @@ def __init__(self, visitor_id=None, client_referrer=None, user_agent=None, bot=N self._location_spoofing = None self._suspect_score = None self._remote_control = None + self._velocity = None self._request_id = None self._browser_details = None self._ip = None @@ -193,6 +196,8 @@ def __init__(self, visitor_id=None, client_referrer=None, user_agent=None, bot=N self.suspect_score = suspect_score if remote_control is not None: self.remote_control = remote_control + if velocity is not None: + self.velocity = velocity self.request_id = request_id self.browser_details = browser_details self.ip = ip @@ -720,6 +725,27 @@ def remote_control(self, remote_control): self._remote_control = remote_control + @property + def velocity(self): + """Gets the velocity of this WebhookVisit. # noqa: E501 + + + :return: The velocity of this WebhookVisit. # noqa: E501 + :rtype: VelocityResult + """ + return self._velocity + + @velocity.setter + def velocity(self, velocity): + """Sets the velocity of this WebhookVisit. + + + :param velocity: The velocity of this WebhookVisit. # noqa: E501 + :type: VelocityResult + """ + + self._velocity = velocity + @property def request_id(self): """Gets the request_id of this WebhookVisit. # noqa: E501 diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index b62f8453..8066c277 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -514,6 +514,23 @@ paths: result: 0 remoteControl: result: false + velocity: + distinctIp: + intervals: + 5m: 1 + 1h: 1 + 24h: 1 + distinctLinkedId: {} + distinctCountry: + intervals: + 5m: 1 + 1h: 2 + 24h: 2 + events: + intervals: + 5m: 1 + 1h: 5 + 24h: 5 responses: default: description: The server doesn't validate the answer. @@ -870,6 +887,8 @@ components: $ref: '#/components/schemas/SuspectScoreResult' remoteControl: $ref: '#/components/schemas/RemoteControlResult' + velocity: + $ref: '#/components/schemas/VelocityResult' requestId: description: Unique identifier of the user's identification request. type: string @@ -1599,6 +1618,15 @@ components: $ref: '#/components/schemas/RemoteControlResult' error: $ref: '#/components/schemas/ProductError' + velocity: + title: SignalResponseVelocity + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/VelocityResult' + error: + $ref: '#/components/schemas/ProductError' EventResponse: description: >- Contains results from all activated products - Fingerprint Pro, Bot @@ -1890,6 +1918,36 @@ components: example: 0 required: - result + VelocityResult: + type: object + description: > + Sums key data points for a specific `visitorId` at three distinct time + intervals: 5 minutes, 1 hour, and 24 hours as follows: + + - Number of identification events attributed to the visitor ID - Number + of distinct IP addresses associated to the visitor ID. - Number of + distinct countries associated with the visitor ID. - Number of distinct + `linkedId`s associated with the visitor ID. + + The `24h` interval of `distinctIp`, `distinctLinkedId`, and + `distinctCountry` will be omitted if the number of `events` for the + visitor ID in the last 24 hours (`events.intervals.['24h']`) is higher + than 20.000. + additionalProperties: false + properties: + distinctIp: + $ref: '#/components/schemas/VelocityIntervals' + distinctLinkedId: + $ref: '#/components/schemas/VelocityIntervals' + distinctCountry: + $ref: '#/components/schemas/VelocityIntervals' + events: + $ref: '#/components/schemas/VelocityIntervals' + required: + - distinctIp + - distinctLinkedId + - distinctCountry + - events RawDeviceAttributesResult: type: object description: > @@ -2176,3 +2234,33 @@ components: required: - code - message + VelocityIntervals: + type: object + additionalProperties: false + properties: + intervals: + $ref: '#/components/schemas/VelocityIntervalResult' + VelocityIntervalResult: + type: object + description: > + Is absent if the velocity data could not be generated for the visitor + ID. + additionalProperties: false + properties: + 5m: + type: integer + example: 1 + 1h: + type: integer + example: 1 + 24h: + type: integer + description: > + The `24h` interval of `distinctIp`, `distinctLinkedId`, and + `distinctCountry` will be omitted if the number of `events`` for the + visitor ID in the last 24 hours (`events.intervals.['24h']`) is + higher than 20.000. + example: 1 + required: + - 5m + - 1h diff --git a/test/mocks/get_event_200.json b/test/mocks/get_event_200.json index 1c82bcee..0769ddb1 100644 --- a/test/mocks/get_event_200.json +++ b/test/mocks/get_event_200.json @@ -277,6 +277,32 @@ "data": { "result": false } + }, + "velocity": { + "data": { + "distinctIp": { + "intervals": { + "5m": 1, + "1h": 1, + "24h": 1 + } + }, + "distinctLinkedId": {}, + "distinctCountry": { + "intervals": { + "5m": 1, + "1h": 2, + "24h": 2 + } + }, + "events": { + "intervals": { + "5m": 1, + "1h": 5, + "24h": 5 + } + } + } } } -} +} \ No newline at end of file diff --git a/test/mocks/get_event_200_all_errors.json b/test/mocks/get_event_200_all_errors.json index 3af20f39..1308990d 100644 --- a/test/mocks/get_event_200_all_errors.json +++ b/test/mocks/get_event_200_all_errors.json @@ -141,6 +141,12 @@ "code": "Failed", "message": "internal server error" } + }, + "velocity": { + "error": { + "code": "Failed", + "message": "internal server error" + } } } } diff --git a/test/mocks/webhook.json b/test/mocks/webhook.json index ac15bb4e..781e9c78 100644 --- a/test/mocks/webhook.json +++ b/test/mocks/webhook.json @@ -191,5 +191,29 @@ }, "remoteControl": { "result": false + }, + "velocity": { + "distinctIp": { + "intervals": { + "5m": 1, + "1h": 1, + "24h": 1 + } + }, + "distinctLinkedId": {}, + "distinctCountry": { + "intervals": { + "5m": 1, + "1h": 2, + "24h": 2 + } + }, + "events": { + "intervals": { + "5m": 1, + "1h": 5, + "24h": 5 + } + } } }