Coverage for fingerprint_server_sdk / models / supplementary_id_high_recall.py: 73%
37 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-23 09:55 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-23 09:55 +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.
6The version of the OpenAPI document: 4
7Contact: support@fingerprint.com
8Generated by OpenAPI Generator (https://openapi-generator.tech)
10Do not edit the class manually.
11""" # noqa: E501
13from __future__ import annotations
15import json
16import pprint
17import re # noqa: F401
18from typing import Any, ClassVar, Optional
20from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21from typing_extensions import Self
23from fingerprint_server_sdk.models.identification_confidence import IdentificationConfidence
26class SupplementaryIDHighRecall(BaseModel):
27 """
28 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.
29 """
31 visitor_id: StrictStr = Field(
32 description="The High Recall identifier for the visitor's browser. It is an alphanumeric string with a maximum length of 25 characters."
33 )
34 visitor_found: StrictBool = Field(
35 description='True if this is a returning browser and has been previously identified. Otherwise, false.'
36 )
37 confidence: Optional[IdentificationConfidence] = None
38 first_seen_at: Optional[StrictInt] = Field(
39 default=None,
40 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 ',
41 )
42 last_seen_at: Optional[StrictInt] = Field(
43 default=None,
44 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 ',
45 )
46 __properties: ClassVar[list[str]] = [
47 'visitor_id',
48 'visitor_found',
49 'confidence',
50 'first_seen_at',
51 'last_seen_at',
52 ]
54 model_config = ConfigDict(
55 populate_by_name=True,
56 validate_assignment=True,
57 protected_namespaces=(),
58 )
60 def to_str(self) -> str:
61 """Returns the string representation of the model using alias"""
62 return pprint.pformat(self.model_dump(by_alias=True))
64 def to_json(self) -> str:
65 """Returns the JSON representation of the model using alias"""
66 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67 return json.dumps(self.to_dict())
69 @classmethod
70 def from_json(cls, json_str: str) -> Optional[Self]:
71 """Create an instance of SupplementaryIDHighRecall from a JSON string"""
72 return cls.from_dict(json.loads(json_str))
74 def to_dict(self) -> dict[str, Any]:
75 """Return the dictionary representation of the model using alias.
77 This has the following differences from calling pydantic's
78 `self.model_dump(by_alias=True)`:
80 * `None` is only added to the output dict for nullable fields that
81 were set at model initialization. Other fields with value `None`
82 are ignored.
83 """
84 excluded_fields: set[str] = set([])
86 _dict = self.model_dump(
87 by_alias=True,
88 exclude=excluded_fields,
89 exclude_none=True,
90 )
91 # override the default output from pydantic by calling `to_dict()` of confidence
92 if self.confidence:
93 _dict['confidence'] = self.confidence.to_dict()
94 return _dict
96 @classmethod
97 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
98 """Create an instance of SupplementaryIDHighRecall from a dict"""
99 if obj is None:
100 return None
102 if not isinstance(obj, dict):
103 return cls.model_validate(obj)
105 _obj = cls.model_validate(
106 {
107 'visitor_id': obj.get('visitor_id'),
108 'visitor_found': obj.get('visitor_found'),
109 'confidence': IdentificationConfidence.from_dict(obj['confidence'])
110 if obj.get('confidence') is not None
111 else None,
112 'first_seen_at': obj.get('first_seen_at'),
113 'last_seen_at': obj.get('last_seen_at'),
114 }
115 )
116 return _obj