diff --git a/docs/Event.md b/docs/Event.md index e1829283..40792f0a 100644 --- a/docs/Event.md +++ b/docs/Event.md @@ -1,5 +1,10 @@ # Event -Contains results from Fingerprint Identification and all active Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. +Contains results from Fingerprint Identification and all active Smart Signals, or from the Automation Intelligence API. Check `source` to see which properties can be present: +- `device` - generated by the JS agent or a mobile SDK running on an end-user device. Contains Identification (`visitor_id`) and Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. +- `edge` - generated by the Automation Intelligence API (`/edge` endpoint). Contains only IP and bot analysis, never Identification or Smart Signals derived from device telemetry. + +Events stored before `source` was added don't have it; treat them as `device`. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. + ## Properties Name | Type | Description | Notes diff --git a/docs/FingerprintApi.md b/docs/FingerprintApi.md index 66934114..990a2dbd 100644 --- a/docs/FingerprintApi.md +++ b/docs/FingerprintApi.md @@ -199,7 +199,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **search_events** -> EventSearch search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, source=source, active_call=active_call) +> EventSearch search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, active_call=active_call, source=source) Search events @@ -311,12 +311,12 @@ total_hits: int = 100 # When set, the response will include a `total_hits` prope tor_node: bool = True # Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional) incremental_identification_status: SearchEventsIncrementalIdentificationStatus = fingerprint_server_sdk.SearchEventsIncrementalIdentificationStatus() # Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional) simulator: bool = True # Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional) -source: List[SearchEventsSource] = [fingerprint_server_sdk.SearchEventsSource()] # Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional) active_call: bool = True # Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional) +source: List[SearchEventsSource] = [fingerprint_server_sdk.SearchEventsSource()] # Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional) try: # Search events - api_response = api_instance.search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, source=source, active_call=active_call) + api_response = api_instance.search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, active_call=active_call, source=source) print("The response of FingerprintApi->search_events:\n") pprint(api_response) except ApiException as e: @@ -385,8 +385,8 @@ Name | Type | Description | Notes **tor_node** | **bool**| Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. | [optional] **incremental_identification_status** | [**SearchEventsIncrementalIdentificationStatus**](.md)| Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. | [optional] **simulator** | **bool**| Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. | [optional] - **source** | [**List[SearchEventsSource]**](SearchEventsSource.md)| Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. | [optional] **active_call** | **bool**| Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. | [optional] + **source** | [**List[SearchEventsSource]**](SearchEventsSource.md)| Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. | [optional] ### Return type diff --git a/fingerprint_server_sdk/api/fingerprint_api.py b/fingerprint_server_sdk/api/fingerprint_api.py index 145c04e1..7fcd97a6 100644 --- a/fingerprint_server_sdk/api/fingerprint_api.py +++ b/fingerprint_server_sdk/api/fingerprint_api.py @@ -873,18 +873,18 @@ def search_events( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -998,10 +998,10 @@ def search_events( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1071,8 +1071,8 @@ def search_events( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1397,18 +1397,18 @@ def search_events_with_http_info( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1522,10 +1522,10 @@ def search_events_with_http_info( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1595,8 +1595,8 @@ def search_events_with_http_info( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1921,18 +1921,18 @@ def search_events_without_preload_content( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2046,10 +2046,10 @@ def search_events_without_preload_content( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2119,8 +2119,8 @@ def search_events_without_preload_content( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2192,8 +2192,8 @@ def _search_events_serialize( tor_node: Optional[bool], incremental_identification_status: Optional[SearchEventsIncrementalIdentificationStatus], simulator: Optional[bool], - source: Optional[list[SearchEventsSource]], active_call: Optional[bool], + source: Optional[list[SearchEventsSource]], _request_auth: Optional[dict[StrictStr, Any]], _content_type: Optional[StrictStr], _headers: Optional[dict[StrictStr, Any]], @@ -2431,14 +2431,14 @@ def _search_events_serialize( if simulator is not None: _query_params.append(('simulator', simulator)) - # process the query parameters - if source is not None: - _query_params.append(('source', source)) - # process the query parameters if active_call is not None: _query_params.append(('active_call', active_call)) + # process the query parameters + if source is not None: + _query_params.append(('source', source)) + # set the HTTP header `Accept` if 'Accept' not in _header_params: _header_params['Accept'] = self.api_client.select_header_accept(['application/json']) diff --git a/fingerprint_server_sdk/models/event.py b/fingerprint_server_sdk/models/event.py index a9043e59..aeee8cda 100644 --- a/fingerprint_server_sdk/models/event.py +++ b/fingerprint_server_sdk/models/event.py @@ -50,7 +50,7 @@ class Event(BaseModel): """ - Contains results from Fingerprint Identification and all active Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. + Contains results from Fingerprint Identification and all active Smart Signals, or from the Automation Intelligence API. Check `source` to see which properties can be present: - `device` - generated by the JS agent or a mobile SDK running on an end-user device. Contains Identification (`visitor_id`) and Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. - `edge` - generated by the Automation Intelligence API (`/edge` endpoint). Contains only IP and bot analysis, never Identification or Smart Signals derived from device telemetry. Events stored before `source` was added don't have it; treat them as `device`. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. """ event_id: StrictStr = Field( diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index bc18d5b1..11a89483 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -940,6 +940,18 @@ paths: > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. + - name: active_call + in: query + schema: + type: boolean + description: > + Filter events by Active Call Detection result on mobile devices. + + + > Note: When using this parameter, only events with the + `active_call` property set to `true` or `false` are returned. Events + without an `active_call` Smart Signal result are left out of the + response. - name: source in: query required: false @@ -963,18 +975,6 @@ paths: > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - - name: active_call - in: query - schema: - type: boolean - description: > - Filter events by Active Call Detection result on mobile devices. - - - > Note: When using this parameter, only events with the - `active_call` property set to `true` or `false` are returned. Events - without an `active_call` Smart Signal result are left out of the - response. responses: '200': description: Events matching the filter(s). @@ -1190,6 +1190,11 @@ components: enum: - device - edge + EnvironmentId: + type: string + examples: + - ae_47abaca3db2c7c43 + description: Environment ID of the event. Url: type: string examples: @@ -1706,11 +1711,6 @@ components: enum: - partially_completed - completed - EnvironmentId: - type: string - examples: - - ae_47abaca3db2c7c43 - description: Environment ID of the event. Suspect: type: boolean description: >- @@ -3132,11 +3132,24 @@ components: team](https://fingerprint.com/support/). Event: type: object - description: >- + description: > Contains results from Fingerprint Identification and all active Smart + Signals, or from the Automation Intelligence API. Check `source` to see + which properties can be present: + + - `device` - generated by the JS agent or a mobile SDK running on an + end-user device. Contains Identification (`visitor_id`) and Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported - devices. Consult the [Smart Signals + devices. + + - `edge` - generated by the Automation Intelligence API (`/edge` + endpoint). Contains only IP and bot analysis, never Identification or + Smart Signals derived from device telemetry. + + + Events stored before `source` was added don't have it; treat them as + `device`. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. required: diff --git a/test/mocks/events/get_event_with_edge_200.json b/test/mocks/events/get_event_with_edge_200.json new file mode 100644 index 00000000..387c86eb --- /dev/null +++ b/test/mocks/events/get_event_with_edge_200.json @@ -0,0 +1,51 @@ +{ + "event_id": "1758130560902.8tRtrH", + "timestamp": 1758130560902, + "source": "edge", + "url": "https://example.com/login?foo=bar", + "bot_info": { + "category": "ai_agent", + "provider": "OpenAI", + "provider_url": "https://openai.com", + "name": "ChatGPT Agent", + "identity": "signed", + "confidence": "high" + }, + "ip_info": { + "v4": { + "address": "104.210.139.192", + "geolocation": { + "accuracy_radius": 20, + "latitude": 29.42412, + "longitude": -98.49363, + "postal_code": "78205", + "timezone": "America/Chicago", + "city_name": "San Antonio", + "country_code": "US", + "country_name": "United States", + "continent_code": "NA", + "continent_name": "North America", + "subdivisions": [ + { + "iso_code": "TX", + "name": "Texas" + } + ] + }, + "asn": "8075", + "asn_name": "Microsoft Corporation", + "asn_network": "104.208.0.0/13", + "asn_type": "hosting", + "datacenter_result": true, + "datacenter_name": "Microsoft Azure" + } + }, + "proxy": false, + "proxy_confidence": "high", + "vpn": false, + "vpn_confidence": "medium", + "vpn_methods": { + "public_vpn": false, + "relay": false + } +} \ No newline at end of file diff --git a/test/test_event_source.py b/test/test_event_source.py new file mode 100644 index 00000000..282efaea --- /dev/null +++ b/test/test_event_source.py @@ -0,0 +1,54 @@ +import json +import unittest +from pathlib import Path +from typing import Any + +from fingerprint_server_sdk import Event +from fingerprint_server_sdk.models.event_source import EventSource + +MOCK_DIR = Path(__file__).resolve().parent / 'mocks' / 'events' + + +def _load(name: str) -> dict[str, Any]: + return json.loads((MOCK_DIR / name).read_text(encoding='utf-8')) + + +class TestEventSource(unittest.TestCase): + """Event stays one model whether or not `source` is present (flat v4 schema).""" + + def test_legacy_event_without_source(self) -> None: + data = _load('get_event_200.json') + data.pop('source', None) + + event = Event.from_dict(data) + + self.assertIsNotNone(event) + assert event is not None + self.assertIsNone(event.source) + self.assertEqual(event.event_id, data['event_id']) + self.assertEqual(event.identification.visitor_id, data['identification']['visitor_id']) + self.assertNotIn('source', event.to_dict()) + + def test_edge_event_without_identification(self) -> None: + data = _load('get_event_with_edge_200.json') + self.assertEqual(data['source'], 'edge') + self.assertNotIn('identification', data) + + event = Event.from_json(json.dumps(data)) + + self.assertIsNotNone(event) + assert event is not None + self.assertEqual(event.source, EventSource.EDGE) + self.assertIsNone(event.identification) + self.assertEqual(event.bot_info.name, 'ChatGPT Agent') + self.assertEqual(event.to_dict()['source'], 'edge') + + def test_device_event_with_source(self) -> None: + data = _load('get_event_200.json') + data['source'] = 'device' + + event = Event.from_dict(data) + + assert event is not None + self.assertEqual(event.source, EventSource.DEVICE) + self.assertIsNotNone(event.identification) diff --git a/test/test_fingerprint_api.py b/test/test_fingerprint_api.py index d79951b9..73cfc3fb 100644 --- a/test/test_fingerprint_api.py +++ b/test/test_fingerprint_api.py @@ -460,8 +460,8 @@ def test_search_events_all_params(self) -> None: 'bot_info_confidence': [BotInfoConfidence.HIGH, BotInfoConfidence.MEDIUM], 'bot_info_provider': ['provider'], 'bot_info_name': ['name1', 'name2'], - 'source': [SearchEventsSource.EDGE], 'active_call': True, + 'source': [SearchEventsSource.EDGE], } # URL params use serialized values (enum.value, lowercase bool) in API definition order url_params = { @@ -514,8 +514,8 @@ def test_search_events_all_params(self) -> None: 'tor_node': 'true', 'incremental_identification_status': 'partially_completed', 'simulator': 'true', - 'source': ['edge'], 'active_call': 'true', + 'source': ['edge'], } mock_pool = MockPoolManager(self)