Coverage for fingerprint_server_sdk/models/device_details.py: 75%
32 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-10-15 10:54 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-10-15 10:54 +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, StrictStr
22from typing_extensions import Self
25class DeviceDetails(BaseModel):
26 """
27 Native, SDK-collected mobile device identification signals (manufacturer, model, and OS version). Structurally separate from the top-level `device`, `os`, and `os_version` fields and from `browser_details`, all of which are derived from user-agent parsing rather than native SDK signals.
28 """
30 device_manufacturer: Optional[StrictStr] = Field(
31 default=None,
32 description='Raw device manufacturer string as reported by the device OS. Not normalized: casing is vendor-defined (samsung, Xiaomi, OPPO, HUAWEI). Always `Apple` on iOS.',
33 )
34 device_model: Optional[StrictStr] = Field(
35 default=None,
36 description='Raw device model identifier, as reported by the mobile OS. On Android, this is the vendor-defined model string (e.g., `SM-G991U`). On iOS, this is an Apple board code (e.g., `D84AP`).',
37 )
38 os_version: Optional[StrictStr] = Field(
39 default=None,
40 description="Mobile operating system version. Component count is not fixed and must not be assumed by consumers: iOS always reports `major.minor.patch` (e.g. `17.4.1`), while Android's precision varies by OS era and which raw signal resolved it — `major` only (`9`, `13`) since Android 10 dropped point releases, `major.minor` (`16.1`) from Android 16 (API 36+) reintroducing a minor component, or a genuine `major.minor.patch` (`8.1.0`) on pre-Android 10 devices that shipped real point releases. Never a fabricated/zero-padded component.",
41 )
42 __properties: ClassVar[list[str]] = ['device_manufacturer', 'device_model', 'os_version']
44 model_config = ConfigDict(
45 populate_by_name=True,
46 validate_assignment=True,
47 protected_namespaces=(),
48 )
50 def to_str(self) -> str:
51 """Returns the string representation of the model using alias"""
52 return pprint.pformat(self.model_dump(by_alias=True))
54 def to_json(self) -> str:
55 """Returns the JSON representation of the model using alias"""
56 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57 return json.dumps(self.to_dict())
59 @classmethod
60 def from_json(cls, json_str: str) -> Optional[Self]:
61 """Create an instance of DeviceDetails from a JSON string"""
62 return cls.from_dict(json.loads(json_str))
64 def to_dict(self) -> dict[str, Any]:
65 """Return the dictionary representation of the model using alias.
67 This has the following differences from calling pydantic's
68 `self.model_dump(by_alias=True)`:
70 * `None` is only added to the output dict for nullable fields that
71 were set at model initialization. Other fields with value `None`
72 are ignored.
73 """
74 excluded_fields: set[str] = set([])
76 _dict = self.model_dump(
77 by_alias=True,
78 exclude=excluded_fields,
79 exclude_none=True,
80 )
81 return _dict
83 @classmethod
84 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
85 """Create an instance of DeviceDetails from a dict"""
86 if obj is None:
87 return None
89 if not isinstance(obj, dict):
90 return cls.model_validate(obj)
92 _obj = cls.model_validate(
93 {
94 'device_manufacturer': obj.get('device_manufacturer'),
95 'device_model': obj.get('device_model'),
96 'os_version': obj.get('os_version'),
97 }
98 )
99 return _obj