Coverage for fingerprint_server_sdk / models / plugins_inner.py: 64%
39 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
23from fingerprint_server_sdk.models.plugins_inner_mime_types_inner import PluginsInnerMimeTypesInner
26class PluginsInner(BaseModel):
27 """
28 PluginsInner
29 """
31 name: StrictStr
32 description: Optional[StrictStr] = None
33 mime_types: Optional[list[PluginsInnerMimeTypesInner]] = Field(default=None, alias='mimeTypes')
34 __properties: ClassVar[list[str]] = ['name', 'description', 'mimeTypes']
36 model_config = ConfigDict(
37 populate_by_name=True,
38 validate_assignment=True,
39 protected_namespaces=(),
40 )
42 def to_str(self) -> str:
43 """Returns the string representation of the model using alias"""
44 return pprint.pformat(self.model_dump(by_alias=True))
46 def to_json(self) -> str:
47 """Returns the JSON representation of the model using alias"""
48 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49 return json.dumps(self.to_dict())
51 @classmethod
52 def from_json(cls, json_str: str) -> Optional[Self]:
53 """Create an instance of PluginsInner from a JSON string"""
54 return cls.from_dict(json.loads(json_str))
56 def to_dict(self) -> dict[str, Any]:
57 """Return the dictionary representation of the model using alias.
59 This has the following differences from calling pydantic's
60 `self.model_dump(by_alias=True)`:
62 * `None` is only added to the output dict for nullable fields that
63 were set at model initialization. Other fields with value `None`
64 are ignored.
65 """
66 excluded_fields: set[str] = set([])
68 _dict = self.model_dump(
69 by_alias=True,
70 exclude=excluded_fields,
71 exclude_none=True,
72 )
73 # override the default output from pydantic by calling `to_dict()` of each item in mime_types (list)
74 _items = []
75 if self.mime_types:
76 for _item_mime_types in self.mime_types:
77 if _item_mime_types:
78 _items.append(_item_mime_types.to_dict())
79 _dict['mimeTypes'] = _items
80 return _dict
82 @classmethod
83 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
84 """Create an instance of PluginsInner from a dict"""
85 if obj is None:
86 return None
88 if not isinstance(obj, dict):
89 return cls.model_validate(obj)
91 _obj = cls.model_validate(
92 {
93 'name': obj.get('name'),
94 'description': obj.get('description'),
95 'mimeTypes': [
96 PluginsInnerMimeTypesInner.from_dict(_item) for _item in obj['mimeTypes']
97 ]
98 if obj.get('mimeTypes') is not None
99 else None,
100 }
101 )
102 return _obj