diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 75a51835..54b0bf58 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -40,9 +40,11 @@ docs/RuleActionType.md docs/SDK.md docs/SealedResults.md docs/SearchEventsBot.md +docs/SearchEventsEndParameter.md docs/SearchEventsIncrementalIdentificationStatus.md docs/SearchEventsRareDevicePercentileBucket.md docs/SearchEventsSdkPlatform.md +docs/SearchEventsStartParameter.md docs/SearchEventsVpnConfidence.md docs/SupplementaryIDHighRecall.md docs/TamperingConfidence.md @@ -100,9 +102,11 @@ fingerprint_server_sdk/models/rule_action_header_field.py fingerprint_server_sdk/models/rule_action_type.py fingerprint_server_sdk/models/sdk.py fingerprint_server_sdk/models/search_events_bot.py +fingerprint_server_sdk/models/search_events_end_parameter.py fingerprint_server_sdk/models/search_events_incremental_identification_status.py fingerprint_server_sdk/models/search_events_rare_device_percentile_bucket.py fingerprint_server_sdk/models/search_events_sdk_platform.py +fingerprint_server_sdk/models/search_events_start_parameter.py fingerprint_server_sdk/models/search_events_vpn_confidence.py fingerprint_server_sdk/models/supplementary_id_high_recall.py fingerprint_server_sdk/models/tampering_confidence.py diff --git a/README.md b/README.md index 0abedbc2..84a27122 100644 --- a/README.md +++ b/README.md @@ -363,9 +363,11 @@ Class | Method | HTTP request | Description - [RuleActionType](docs/RuleActionType.md) - [SDK](docs/SDK.md) - [SearchEventsBot](docs/SearchEventsBot.md) + - [SearchEventsEndParameter](docs/SearchEventsEndParameter.md) - [SearchEventsIncrementalIdentificationStatus](docs/SearchEventsIncrementalIdentificationStatus.md) - [SearchEventsRareDevicePercentileBucket](docs/SearchEventsRareDevicePercentileBucket.md) - [SearchEventsSdkPlatform](docs/SearchEventsSdkPlatform.md) + - [SearchEventsStartParameter](docs/SearchEventsStartParameter.md) - [SearchEventsVpnConfidence](docs/SearchEventsVpnConfidence.md) - [SupplementaryIDHighRecall](docs/SupplementaryIDHighRecall.md) - [TamperingConfidence](docs/TamperingConfidence.md) diff --git a/docs/FingerprintApi.md b/docs/FingerprintApi.md index 4c39203f..5dcef4f3 100644 --- a/docs/FingerprintApi.md +++ b/docs/FingerprintApi.md @@ -252,8 +252,8 @@ url: str = 'url_example' # Filter events by the URL (`url` property) associated bundle_id: str = 'bundle_id_example' # Filter events by the Bundle ID (iOS) associated with the event. (optional) package_name: str = 'package_name_example' # Filter events by the Package Name (Android) associated with the event. (optional) origin: str = 'origin_example' # Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional) -start: int = 1767225600000 # Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. (optional) -end: int = 1769903999000 # Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. (optional) +start: SearchEventsStartParameter = fingerprint_server_sdk.SearchEventsStartParameter() # Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. (optional) +end: SearchEventsEndParameter = fingerprint_server_sdk.SearchEventsEndParameter() # Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. (optional) reverse: bool = True # When `true`, sort events oldest first (ascending timestamp order). Default is newest first (descending timestamp order). (optional) suspect: bool = True # Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > 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. (optional) vpn: bool = True # Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional) @@ -318,8 +318,8 @@ Name | Type | Description | Notes **bundle_id** | **str**| Filter events by the Bundle ID (iOS) associated with the event. | [optional] **package_name** | **str**| Filter events by the Package Name (Android) associated with the event. | [optional] **origin** | **str**| Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) | [optional] - **start** | **int**| Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. | [optional] - **end** | **int**| Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. | [optional] + **start** | [**SearchEventsStartParameter**](.md)| Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. | [optional] + **end** | [**SearchEventsEndParameter**](.md)| Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. | [optional] **reverse** | **bool**| When `true`, sort events oldest first (ascending timestamp order). Default is newest first (descending timestamp order). | [optional] **suspect** | **bool**| Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > 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. | [optional] **vpn** | **bool**| Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. | [optional] diff --git a/docs/SearchEventsEndParameter.md b/docs/SearchEventsEndParameter.md new file mode 100644 index 00000000..3a6341b1 --- /dev/null +++ b/docs/SearchEventsEndParameter.md @@ -0,0 +1,7 @@ +# SearchEventsEndParameter +## Type alias + +`Union[datetime,int]` + +[[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/SearchEventsStartParameter.md b/docs/SearchEventsStartParameter.md new file mode 100644 index 00000000..6fab9151 --- /dev/null +++ b/docs/SearchEventsStartParameter.md @@ -0,0 +1,7 @@ +# SearchEventsStartParameter +## Type alias + +`Union[datetime,int]` + +[[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/examples/search_events_example.py b/examples/search_events_example.py index 5173598d..df78c520 100644 --- a/examples/search_events_example.py +++ b/examples/search_events_example.py @@ -20,11 +20,9 @@ end = datetime.now(tz=timezone.utc) start = end - timedelta(days=7) -start_timestamp = int(start.timestamp() * 1000) -end_timestamp = int(end.timestamp() * 1000) try: - response = api_instance.search_events(limit=10, start=start_timestamp, end=end_timestamp) + response = api_instance.search_events(limit=10, start=start, end=end) print(f'Found {len(response.events)} events') for event in response.events: @@ -35,8 +33,8 @@ print(f'Fetching next page with pagination_key: {response.pagination_key}') next_page = api_instance.search_events( limit=10, - start=start_timestamp, - end=end_timestamp, + start=start, + end=end, pagination_key=response.pagination_key, ) print(f'Found {len(next_page.events)} more events on next page') diff --git a/fingerprint_server_sdk/__init__.py b/fingerprint_server_sdk/__init__.py index 012853b5..13df7e7c 100644 --- a/fingerprint_server_sdk/__init__.py +++ b/fingerprint_server_sdk/__init__.py @@ -79,9 +79,11 @@ 'RuleActionType', 'SDK', 'SearchEventsBot', + 'SearchEventsEndParameter', 'SearchEventsIncrementalIdentificationStatus', 'SearchEventsRareDevicePercentileBucket', 'SearchEventsSdkPlatform', + 'SearchEventsStartParameter', 'SearchEventsVpnConfidence', 'SupplementaryIDHighRecall', 'TamperingConfidence', @@ -160,6 +162,7 @@ from fingerprint_server_sdk.models.rule_action_type import RuleActionType from fingerprint_server_sdk.models.sdk import SDK from fingerprint_server_sdk.models.search_events_bot import SearchEventsBot +from fingerprint_server_sdk.models.search_events_end_parameter import SearchEventsEndParameter from fingerprint_server_sdk.models.search_events_incremental_identification_status import ( SearchEventsIncrementalIdentificationStatus, ) @@ -167,6 +170,7 @@ SearchEventsRareDevicePercentileBucket, ) from fingerprint_server_sdk.models.search_events_sdk_platform import SearchEventsSdkPlatform +from fingerprint_server_sdk.models.search_events_start_parameter import SearchEventsStartParameter from fingerprint_server_sdk.models.search_events_vpn_confidence import SearchEventsVpnConfidence from fingerprint_server_sdk.models.supplementary_id_high_recall import SupplementaryIDHighRecall from fingerprint_server_sdk.models.tampering_confidence import TamperingConfidence diff --git a/fingerprint_server_sdk/api/fingerprint_api.py b/fingerprint_server_sdk/api/fingerprint_api.py index 71dd5ed4..8598e213 100644 --- a/fingerprint_server_sdk/api/fingerprint_api.py +++ b/fingerprint_server_sdk/api/fingerprint_api.py @@ -10,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 +from datetime import date, datetime from typing import Annotated, Any, Optional, Union # noqa: UP035 from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, validate_call @@ -21,6 +22,7 @@ from fingerprint_server_sdk.models.event_search import EventSearch from fingerprint_server_sdk.models.event_update import EventUpdate from fingerprint_server_sdk.models.search_events_bot import SearchEventsBot +from fingerprint_server_sdk.models.search_events_end_parameter import SearchEventsEndParameter from fingerprint_server_sdk.models.search_events_incremental_identification_status import ( SearchEventsIncrementalIdentificationStatus, ) @@ -28,6 +30,7 @@ SearchEventsRareDevicePercentileBucket, ) from fingerprint_server_sdk.models.search_events_sdk_platform import SearchEventsSdkPlatform +from fingerprint_server_sdk.models.search_events_start_parameter import SearchEventsStartParameter from fingerprint_server_sdk.models.search_events_vpn_confidence import SearchEventsVpnConfidence from fingerprint_server_sdk.rest import RESTResponseType @@ -621,15 +624,15 @@ def search_events( ), ] = None, start: Annotated[ - Optional[StrictInt], + Optional[SearchEventsStartParameter], Field( - description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. " + description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. ", ), ] = None, end: Annotated[ - Optional[StrictInt], + Optional[SearchEventsEndParameter], Field( - description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. " + description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. ", ), ] = None, reverse: Annotated[ @@ -849,10 +852,10 @@ def search_events( :type package_name: str :param origin: Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) :type origin: str - :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. - :type start: int - :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. - :type end: int + :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. + :type start: SearchEventsStartParameter + :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. + :type end: SearchEventsEndParameter :param reverse: When `true`, sort events oldest first (ascending timestamp order). Default is newest first (descending timestamp order). :type reverse: bool :param suspect: Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > 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. @@ -1069,15 +1072,15 @@ def search_events_with_http_info( ), ] = None, start: Annotated[ - Optional[StrictInt], + Optional[SearchEventsStartParameter], Field( - description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. " + description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. ", ), ] = None, end: Annotated[ - Optional[StrictInt], + Optional[SearchEventsEndParameter], Field( - description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. " + description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. ", ), ] = None, reverse: Annotated[ @@ -1297,10 +1300,10 @@ def search_events_with_http_info( :type package_name: str :param origin: Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) :type origin: str - :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. - :type start: int - :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. - :type end: int + :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. + :type start: SearchEventsStartParameter + :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. + :type end: SearchEventsEndParameter :param reverse: When `true`, sort events oldest first (ascending timestamp order). Default is newest first (descending timestamp order). :type reverse: bool :param suspect: Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > 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. @@ -1517,15 +1520,15 @@ def search_events_without_preload_content( ), ] = None, start: Annotated[ - Optional[StrictInt], + Optional[SearchEventsStartParameter], Field( - description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. " + description="Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. ", ), ] = None, end: Annotated[ - Optional[StrictInt], + Optional[SearchEventsEndParameter], Field( - description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. " + description="Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. ", ), ] = None, reverse: Annotated[ @@ -1745,10 +1748,10 @@ def search_events_without_preload_content( :type package_name: str :param origin: Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) :type origin: str - :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. - :type start: int - :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. - :type end: int + :param start: Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` — adjust it separately if needed. + :type start: SearchEventsStartParameter + :param end: Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` — adjust it separately if needed. + :type end: SearchEventsEndParameter :param reverse: When `true`, sort events oldest first (ascending timestamp order). Default is newest first (descending timestamp order). :type reverse: bool :param suspect: Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > 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. @@ -1901,8 +1904,8 @@ def _search_events_serialize( bundle_id: Optional[str], package_name: Optional[str], origin: Optional[str], - start: Optional[int], - end: Optional[int], + start: Optional[SearchEventsStartParameter], + end: Optional[SearchEventsEndParameter], reverse: Optional[bool], suspect: Optional[bool], vpn: Optional[bool], @@ -2002,12 +2005,20 @@ def _search_events_serialize( # process the query parameters if start is not None: - _query_params.append(('start', start)) - + if isinstance(start, datetime): + _query_params.append(('start', start.isoformat(timespec='microseconds'))) + elif isinstance(start, date): + _query_params.append(('start', start.isoformat())) + else: + _query_params.append(('start', start)) # process the query parameters if end is not None: - _query_params.append(('end', end)) - + if isinstance(end, datetime): + _query_params.append(('end', end.isoformat(timespec='microseconds'))) + elif isinstance(end, date): + _query_params.append(('end', end.isoformat())) + else: + _query_params.append(('end', end)) # process the query parameters if reverse is not None: _query_params.append(('reverse', reverse)) diff --git a/fingerprint_server_sdk/models/__init__.py b/fingerprint_server_sdk/models/__init__.py index d452587d..a132d0f7 100644 --- a/fingerprint_server_sdk/models/__init__.py +++ b/fingerprint_server_sdk/models/__init__.py @@ -54,6 +54,7 @@ from fingerprint_server_sdk.models.rule_action_type import RuleActionType from fingerprint_server_sdk.models.sdk import SDK from fingerprint_server_sdk.models.search_events_bot import SearchEventsBot +from fingerprint_server_sdk.models.search_events_end_parameter import SearchEventsEndParameter from fingerprint_server_sdk.models.search_events_incremental_identification_status import ( SearchEventsIncrementalIdentificationStatus, ) @@ -61,6 +62,7 @@ SearchEventsRareDevicePercentileBucket, ) from fingerprint_server_sdk.models.search_events_sdk_platform import SearchEventsSdkPlatform +from fingerprint_server_sdk.models.search_events_start_parameter import SearchEventsStartParameter from fingerprint_server_sdk.models.search_events_vpn_confidence import SearchEventsVpnConfidence from fingerprint_server_sdk.models.supplementary_id_high_recall import SupplementaryIDHighRecall from fingerprint_server_sdk.models.tampering_confidence import TamperingConfidence diff --git a/fingerprint_server_sdk/models/search_events_end_parameter.py b/fingerprint_server_sdk/models/search_events_end_parameter.py new file mode 100644 index 00000000..f6e07dd2 --- /dev/null +++ b/fingerprint_server_sdk/models/search_events_end_parameter.py @@ -0,0 +1,17 @@ +""" +Server API +Fingerprint Server API allows you to get, search, and update 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. + +The version of the OpenAPI document: 4 +Contact: support@fingerprint.com +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from typing import Union + +from pydantic import AwareDatetime + +SearchEventsEndParameter = Union[int, AwareDatetime] diff --git a/fingerprint_server_sdk/models/search_events_start_parameter.py b/fingerprint_server_sdk/models/search_events_start_parameter.py new file mode 100644 index 00000000..7004b67c --- /dev/null +++ b/fingerprint_server_sdk/models/search_events_start_parameter.py @@ -0,0 +1,17 @@ +""" +Server API +Fingerprint Server API allows you to get, search, and update 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. + +The version of the OpenAPI document: 4 +Contact: support@fingerprint.com +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from typing import Union + +from pydantic import AwareDatetime + +SearchEventsStartParameter = Union[int, AwareDatetime] diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index 9ac62608..a0c7bc86 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -379,25 +379,34 @@ paths: - name: start in: query schema: - type: integer - format: int64 - example: 1767225600000 + oneOf: + - type: integer + format: int64 + example: 1767225600000 + - type: string + format: date-time + example: '2026-01-01T00:00:00Z' description: > Include events that happened after this point (with timestamp - greater than or equal the provided `start` Unix milliseconds value). - Defaults to 7 days ago. Setting `start` does not change `end`'s - default of `now` — adjust it separately if needed. + greater than or equal the provided `start` Unix milliseconds value + or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does + not change `end`'s default of `now` — adjust it separately if + needed. - name: end in: query schema: - type: integer - format: int64 - example: 1769903999000 + oneOf: + - type: integer + format: int64 + example: 1769903999000 + - type: string + format: date-time + example: '2026-01-31T23:59:59Z' description: > Include events that happened before this point (with timestamp less - than or equal the provided `end` Unix milliseconds value). Defaults - to now. Setting `end` does not change `start`'s default of `7 days - ago` — adjust it separately if needed. + than or equal the provided `end` Unix milliseconds value or RFC3339 + timestamp). Defaults to now. Setting `end` does not change `start`'s + default of `7 days ago` — adjust it separately if needed. - name: reverse in: query schema: diff --git a/test/test_fingerprint_api.py b/test/test_fingerprint_api.py index 79ef3f7c..e70ee2e3 100644 --- a/test/test_fingerprint_api.py +++ b/test/test_fingerprint_api.py @@ -1,4 +1,5 @@ import unittest +from datetime import datetime, timezone from urllib.parse import urlencode from fingerprint_server_sdk import ( @@ -328,6 +329,10 @@ def test_search_events(self) -> None: self.assertEqual(first_event.event_id, '1708102555327.NLOjmg') def test_search_events_all_params(self) -> None: + start_timestamp = 1582299576511 + end_timestamp = 1582299576513 + start_date = datetime.fromtimestamp(start_timestamp / 1000, tz=timezone.utc) + """Test case for search_events with all available parameters""" api_params = { 'limit': 1, @@ -341,8 +346,8 @@ def test_search_events_all_params(self) -> None: 'bundle_id': 'com.example.bundleId', 'package_name': 'com.example', 'origin': 'https://example.com', - 'start': 1582299576511, - 'end': 1582299576513, + 'start': start_date, + 'end': end_timestamp, 'reverse': True, 'suspect': False, 'vpn': True, @@ -389,8 +394,8 @@ def test_search_events_all_params(self) -> None: 'bundle_id': 'com.example.bundleId', 'package_name': 'com.example', 'origin': 'https://example.com', - 'start': 1582299576511, - 'end': 1582299576513, + 'start': start_date.isoformat(), + 'end': end_timestamp, 'reverse': 'true', 'suspect': 'false', 'vpn': 'true',