Coverage for fingerprint_server_sdk/models/supplementary_id_high_recall.py: 73%
37 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
1"""
2Server API
3Fingerprint 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.
4Server 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.
5The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
7The version of the OpenAPI document: 4
8Contact: support@fingerprint.com
9Generated by OpenAPI Generator (https://openapi-generator.tech)
11Do not edit the class manually.
12""" # noqa: E501
14from __future__ import annotations
16import json
17import pprint
18import re # noqa: F401
19from typing import Any, ClassVar, Optional
21from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
22from typing_extensions import Self
24from fingerprint_server_sdk.models.identification_confidence import IdentificationConfidence
27class SupplementaryIDHighRecall(BaseModel):
28 """
29 The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.
30 """
32 visitor_id: StrictStr = Field(
33 description="The High Recall identifier for the visitor's browser. It is an alphanumeric string with a maximum length of 25 characters."
34 )
35 visitor_found: StrictBool = Field(
36 description='True if this is a returning browser and has been previously identified. Otherwise, false.'
37 )
38 confidence: Optional[IdentificationConfidence] = None
39 first_seen_at: Optional[StrictInt] = Field(
40 default=None,
41 description='Unix epoch timestamp (in milliseconds) indicating when the browser was first identified. example: `1758069706642` - Corresponding to Wed Sep 17 2025 00:41:46 GMT+0000 ',
42 )
43 last_seen_at: Optional[StrictInt] = Field(
44 default=None,
45 description='Unix epoch timestamp (in milliseconds) corresponding to the most recent visit by this browser. example: `1758069706642` - Corresponding to Wed Sep 17 2025 00:41:46 GMT+0000 ',
46 )
47 __properties: ClassVar[list[str]] = [
48 'visitor_id',
49 'visitor_found',
50 'confidence',
51 'first_seen_at',
52 'last_seen_at',
53 ]
55 model_config = ConfigDict(
56 populate_by_name=True,
57 validate_assignment=True,
58 protected_namespaces=(),
59 )
61 def to_str(self) -> str:
62 """Returns the string representation of the model using alias"""
63 return pprint.pformat(self.model_dump(by_alias=True))
65 def to_json(self) -> str:
66 """Returns the JSON representation of the model using alias"""
67 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68 return json.dumps(self.to_dict())
70 @classmethod
71 def from_json(cls, json_str: str) -> Optional[Self]:
72 """Create an instance of SupplementaryIDHighRecall from a JSON string"""
73 return cls.from_dict(json.loads(json_str))
75 def to_dict(self) -> dict[str, Any]:
76 """Return the dictionary representation of the model using alias.
78 This has the following differences from calling pydantic's
79 `self.model_dump(by_alias=True)`:
81 * `None` is only added to the output dict for nullable fields that
82 were set at model initialization. Other fields with value `None`
83 are ignored.
84 """
85 excluded_fields: set[str] = set([])
87 _dict = self.model_dump(
88 by_alias=True,
89 exclude=excluded_fields,
90 exclude_none=True,
91 )
92 # override the default output from pydantic by calling `to_dict()` of confidence
93 if self.confidence:
94 _dict['confidence'] = self.confidence.to_dict()
95 return _dict
97 @classmethod
98 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
99 """Create an instance of SupplementaryIDHighRecall from a dict"""
100 if obj is None:
101 return None
103 if not isinstance(obj, dict):
104 return cls.model_validate(obj)
106 _obj = cls.model_validate(
107 {
108 'visitor_id': obj.get('visitor_id'),
109 'visitor_found': obj.get('visitor_found'),
110 'confidence': IdentificationConfidence.from_dict(obj['confidence'])
111 if obj.get('confidence') is not None
112 else None,
113 'first_seen_at': obj.get('first_seen_at'),
114 'last_seen_at': obj.get('last_seen_at'),
115 }
116 )
117 return _obj