Coverage for fingerprint_server_sdk / models / rule_action_header_field.py: 61%
31 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
« 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.
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, StrictStr
21from typing_extensions import Self
24class RuleActionHeaderField(BaseModel):
25 """
26 RuleActionHeaderField
27 """
29 name: StrictStr = Field(description='The header field name.')
30 value: StrictStr = Field(description='The value of the header field.')
31 __properties: ClassVar[list[str]] = ['name', 'value']
33 model_config = ConfigDict(
34 populate_by_name=True,
35 validate_assignment=True,
36 protected_namespaces=(),
37 )
39 def to_str(self) -> str:
40 """Returns the string representation of the model using alias"""
41 return pprint.pformat(self.model_dump(by_alias=True))
43 def to_json(self) -> str:
44 """Returns the JSON representation of the model using alias"""
45 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46 return json.dumps(self.to_dict())
48 @classmethod
49 def from_json(cls, json_str: str) -> Optional[Self]:
50 """Create an instance of RuleActionHeaderField from a JSON string"""
51 return cls.from_dict(json.loads(json_str))
53 def to_dict(self) -> dict[str, Any]:
54 """Return the dictionary representation of the model using alias.
56 This has the following differences from calling pydantic's
57 `self.model_dump(by_alias=True)`:
59 * `None` is only added to the output dict for nullable fields that
60 were set at model initialization. Other fields with value `None`
61 are ignored.
62 """
63 excluded_fields: set[str] = set([])
65 _dict = self.model_dump(
66 by_alias=True,
67 exclude=excluded_fields,
68 exclude_none=True,
69 )
70 return _dict
72 @classmethod
73 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
74 """Create an instance of RuleActionHeaderField from a dict"""
75 if obj is None:
76 return None
78 if not isinstance(obj, dict):
79 return cls.model_validate(obj)
81 _obj = cls.model_validate({'name': obj.get('name'), 'value': obj.get('value')})
82 return _obj