Coverage for fingerprint_server_sdk/models/event_update.py: 72%

32 statements  

« 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. 

6 

7The version of the OpenAPI document: 4 

8Contact: support@fingerprint.com 

9Generated by OpenAPI Generator (https://openapi-generator.tech) 

10 

11Do not edit the class manually. 

12""" # noqa: E501 

13 

14from __future__ import annotations 

15 

16import json 

17import pprint 

18import re # noqa: F401 

19from typing import Any, ClassVar, Optional 

20 

21from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr 

22from typing_extensions import Self 

23 

24 

25class EventUpdate(BaseModel): 

26 """ 

27 EventUpdate 

28 """ 

29 

30 linked_id: Optional[StrictStr] = Field( 

31 default=None, description='Linked ID value to assign to the existing event' 

32 ) 

33 tags: Optional[dict[str, Any]] = Field( 

34 default=None, 

35 description='A customer-provided value or an object that was sent with the identification request or updated later.', 

36 ) 

37 suspect: Optional[StrictBool] = Field( 

38 default=None, description='Suspect flag indicating observed suspicious or fraudulent event' 

39 ) 

40 __properties: ClassVar[list[str]] = ['linked_id', 'tags', 'suspect'] 

41 

42 model_config = ConfigDict( 

43 populate_by_name=True, 

44 validate_assignment=True, 

45 protected_namespaces=(), 

46 ) 

47 

48 def to_str(self) -> str: 

49 """Returns the string representation of the model using alias""" 

50 return pprint.pformat(self.model_dump(by_alias=True)) 

51 

52 def to_json(self) -> str: 

53 """Returns the JSON representation of the model using alias""" 

54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 

55 return json.dumps(self.to_dict()) 

56 

57 @classmethod 

58 def from_json(cls, json_str: str) -> Optional[Self]: 

59 """Create an instance of EventUpdate from a JSON string""" 

60 return cls.from_dict(json.loads(json_str)) 

61 

62 def to_dict(self) -> dict[str, Any]: 

63 """Return the dictionary representation of the model using alias. 

64 

65 This has the following differences from calling pydantic's 

66 `self.model_dump(by_alias=True)`: 

67 

68 * `None` is only added to the output dict for nullable fields that 

69 were set at model initialization. Other fields with value `None` 

70 are ignored. 

71 """ 

72 excluded_fields: set[str] = set([]) 

73 

74 _dict = self.model_dump( 

75 by_alias=True, 

76 exclude=excluded_fields, 

77 exclude_none=True, 

78 ) 

79 return _dict 

80 

81 @classmethod 

82 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: 

83 """Create an instance of EventUpdate from a dict""" 

84 if obj is None: 

85 return None 

86 

87 if not isinstance(obj, dict): 

88 return cls.model_validate(obj) 

89 

90 _obj = cls.model_validate( 

91 { 

92 'linked_id': obj.get('linked_id'), 

93 'tags': obj.get('tags'), 

94 'suspect': obj.get('suspect'), 

95 } 

96 ) 

97 return _obj