Coverage for fingerprint_server_sdk / models / integration_subintegration.py: 74%

31 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, StrictStr 

21from typing_extensions import Self 

22 

23 

24class IntegrationSubintegration(BaseModel): 

25 """ 

26 IntegrationSubintegration 

27 """ 

28 

29 name: Optional[StrictStr] = Field( 

30 default=None, description='The name of the specific subintegration, e.g. "preact".' 

31 ) 

32 version: Optional[StrictStr] = Field( 

33 default=None, description='The version of the specific subintegration, e.g. "10.21.0".' 

34 ) 

35 __properties: ClassVar[list[str]] = ['name', 'version'] 

36 

37 model_config = ConfigDict( 

38 populate_by_name=True, 

39 validate_assignment=True, 

40 protected_namespaces=(), 

41 ) 

42 

43 def to_str(self) -> str: 

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

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

46 

47 def to_json(self) -> str: 

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

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

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

51 

52 @classmethod 

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

54 """Create an instance of IntegrationSubintegration from a JSON string""" 

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

56 

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

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

59 

60 This has the following differences from calling pydantic's 

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

62 

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

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

65 are ignored. 

66 """ 

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

68 

69 _dict = self.model_dump( 

70 by_alias=True, 

71 exclude=excluded_fields, 

72 exclude_none=True, 

73 ) 

74 return _dict 

75 

76 @classmethod 

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

78 """Create an instance of IntegrationSubintegration from a dict""" 

79 if obj is None: 

80 return None 

81 

82 if not isinstance(obj, dict): 

83 return cls.model_validate(obj) 

84 

85 _obj = cls.model_validate({'name': obj.get('name'), 'version': obj.get('version')}) 

86 return _obj