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

32 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-11 18:41 +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. 

5 

6The version of the OpenAPI document: 4 

7Contact: support@fingerprint.com 

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

9 

10Do not edit the class manually. 

11""" # noqa: E501 

12 

13from __future__ import annotations 

14 

15import json 

16import pprint 

17import re # noqa: F401 

18from typing import Any, ClassVar, Optional 

19 

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

21from typing_extensions import Self 

22 

23 

24class EventUpdate(BaseModel): 

25 """ 

26 EventUpdate 

27 """ 

28 

29 linked_id: Optional[StrictStr] = Field( 

30 default=None, description='Linked Id value to assign to the existing event' 

31 ) 

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

33 default=None, 

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

35 ) 

36 suspect: Optional[StrictBool] = Field( 

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

38 ) 

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

40 

41 model_config = ConfigDict( 

42 populate_by_name=True, 

43 validate_assignment=True, 

44 protected_namespaces=(), 

45 ) 

46 

47 def to_str(self) -> str: 

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

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

50 

51 def to_json(self) -> str: 

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

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

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

55 

56 @classmethod 

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

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

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

60 

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

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

63 

64 This has the following differences from calling pydantic's 

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

66 

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

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

69 are ignored. 

70 """ 

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

72 

73 _dict = self.model_dump( 

74 by_alias=True, 

75 exclude=excluded_fields, 

76 exclude_none=True, 

77 ) 

78 return _dict 

79 

80 @classmethod 

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

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

83 if obj is None: 

84 return None 

85 

86 if not isinstance(obj, dict): 

87 return cls.model_validate(obj) 

88 

89 _obj = cls.model_validate( 

90 { 

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

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

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

94 } 

95 ) 

96 return _obj